Esempio n. 1
0
        public void SeparateInitial(string aTable, string aColumnCode, string aColumnName)
        {
            Int32   i      = 0;
            Initial lsIniT = new Initial();
            string  lsSQL  = "";

            try
            {
                lsSQL = "Select count(*) as cnt From " + aTable + " ";
                MySqlCommand    lsCommConter1 = new MySqlCommand(lsSQL, lsConnSelect1);
                MySqlDataReader lsReadCounter1;
                lsReadCounter1 = lsCommConter1.ExecuteReader();
                if (lsReadCounter1.HasRows)
                {
                    while (lsReadCounter1.Read())
                    {
                        Pb1.Maximum = Convert.ToInt32(lsReadCounter1["cnt"].ToString());
                    }
                }
                lsReadCounter1.Close();
                lsSQL = "Select * From " + aTable + " ";
                MySqlCommand    lsCommConter = new MySqlCommand(lsSQL, lsConnSelect1);
                MySqlDataReader lsReadCounter;
                lsReadCounter = lsCommConter.ExecuteReader();
                if (lsReadCounter.HasRows)
                {
                    lsIniT.TableName   = aTable;
                    lsIniT.ColumnCode  = aColumnCode;
                    lsIniT.ColumnNameE = aColumnName;
                    while (lsReadCounter.Read())
                    {
                        lsIniT.DataCode  = lsReadCounter.GetValue(0).ToString();
                        lsIniT.DataNameE = lsReadCounter.GetValue(1).ToString();
                        lsIniT.DataFlag  = lsReadCounter["flag"].ToString();
                        lsIniT.CreateInitial(lsConnUpdate1);
                        i++;
                        GrdRec.ActiveSheet.AddRows(0, 1);
                        GrdRec.ActiveSheet.Cells[0, 0].Text = lsIniT.DataCode;
                        GrdRec.ActiveSheet.Cells[0, 1].Text = lsIniT.DataNameE;
                    }
                }
                lsReadCounter.Close();
            }
            catch (Exception e)
            {
                string ls = "äÁèÊÒÁÒö save ä´é " + aTable;
                lsGdb.WriteLogError(ls, e, aTable, "SeparateInitial ");
                MessageBox.Show(ls + " " + e.Message.ToString(), e.Source.ToString(), MessageBoxButtons.OK);
            }
        }
Esempio n. 2
0
        private void save_Click(object sender, EventArgs e)
        {
            Int32 i = 0;

            lstblIni.TableName   = TableName;
            lstblIni.ColumnCode  = ColumnCode;
            lstblIni.ColumnNameE = ColumnNameE;
            for (i = 0; i <= GrdView.ActiveSheet.RowCount - 1; i++)
            {
                lstblIni.DataCode  = GrdView.ActiveSheet.GetText(i, 0).ToString();
                lstblIni.DataNameE = GrdView.ActiveSheet.GetText(i, 1).ToString();
                //lstblIni.DataNameE = GrdView.ActiveSheet.GetValue(i, 1).ToString();
                lstblIni.DataFlag = "1";
                if (lstblIni.DataCode != "")
                {
                    lstblIni.CreateInitial(lsGdb.Gdb);
                }
            }
            MessageBox.Show("ºÑ¹·Ö¡¢éÍÁÙÅàÃÕºÃéÍÂ", "ºÑ¹·Ö¡", MessageBoxButtons.OK);
            lbSave = true;
        }