예제 #1
0
        public void startAsync(string profilName, string query)
        {
            Profil usedProfil = pWorker.getProfilbyName(profilName);

            if (usedProfil != null)
            {
                DatabaseAsyncParam data = new DatabaseAsyncParam();
                data.UsedProfil = usedProfil;
                data.FieldName  = this.iterationVaribaleName;
                data.ValueName  = this.iterationVaribaleValue;
                data.Query      = query;
                worker.RunWorkerAsync(data);
            }
            else
            {
                this.scrMysqError(" invalid profil: " + profilName);
            }
        }
예제 #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            DatabaseAsyncParam Param = (DatabaseAsyncParam)e.Argument;

            MysqlHandler mysql = new MysqlHandler(Param.UsedProfil);

            mysql.connect();

            List <Hashtable> hashResult = mysql.selectAsHash(Param.Query);
            List <string>    errors     = mysql.getErrorMessages();

            if (errors.Count > 0)
            {
                foreach (string errMsg in errors)
                {
                    //this.scrMysqError(errMsg);
                    worker.ReportProgress(0, errMsg);
                }
            }
            else
            {
                this.lastResult = hashResult;
                foreach (Hashtable row in hashResult)
                {
                    foreach (DictionaryEntry dict in row)
                    {
                        string val;
                        if (dict.Value == null)
                        {
                            val = "";
                        }
                        else
                        {
                            val = dict.Value.ToString();
                        }
                        //this.iteration(dict.Key.ToString(), val);
                        worker.ReportProgress(1, new string[] { dict.Key.ToString(), val });
                    }
                }
            }
            mysql.disConnect();
        }