Пример #1
0
        private string GetData(ref DataTable dt, string StoreProcedureName)
        {
            try
            {
                string[]    Values = new string[] { textBox1.Text.Trim() };
                clsDatabase cls    = new clsDatabase();
                cls.OpenConnect();
                if (Paras.Length != Values.Length)
                {
                    return("Tham bien va tham tri khong tuong thich");
                }
                else
                {
                    cls.getValue(ref dt, StoreProcedureName, Paras, Values);
                }

                cls.CloseConnect();
            }
            catch (Exception ex)
            {
                error = ex.Message;
                MessageBox.Show("Co loi " + ex.Message);
            }
            return(error);
        }
Пример #2
0
 private void SaveStringToDatabase(string[] StringName, string TableName)
 {
     try
     {
         string[] Paras = new string[11] {
             "@Events", "@Site", "@Date", "@Rounds", "@White", "@Black", "@Result", "@WhiteElo", "@BlackElo", "@ECO", "@Plays"
         };
         int _Count = 0;
         foreach (string file in StringName)
         {
             _Count++;
             string strResult = "";
             if ((_Count % 11) == 0)
             {
                 Values[0]  = StringName[_Count - 11];
                 Values[1]  = StringName[_Count - 10];
                 Values[2]  = StringName[_Count - 9];
                 Values[3]  = StringName[_Count - 8];
                 Values[4]  = StringName[_Count - 7];
                 Values[5]  = StringName[_Count - 6];
                 Values[6]  = StringName[_Count - 5];
                 Values[7]  = StringName[_Count - 4];
                 Values[8]  = StringName[_Count - 3];
                 Values[9]  = StringName[_Count - 2];
                 Values[10] = StringName[_Count - 1];
                 clsDatabase cls = new clsDatabase();
                 cls.OpenConnect();
                 cls.ExecuteSP("InsertTotblPGN", Paras, Values, ref strResult);
                 //MessageBox.Show(strResult);
                 cls.CloseConnect();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }