chào bác , mình thấy bác pro quá,mình thật ngưỡng mộ, mong bác xem cái này giúp mình, mình có đoạn code này bác ly giai giúp mình với, mình cũng hiểu sơ sơ, nhưng tại sao lại chia làm 2 hàm như vậy , và nêu tổng quát ý tưởng của bài này giúp mình
Visual C# Code:
class CSDL { //chuoi ket noi CSDl { } //lay CSDL rA { SqlCommand myCommand; //thuc thi cau lenh sql va chuoi ket noi csdl myconnection myCommand.CommandType = commandType;//kieu thuc thi= cau lenh sql hay thu tuc trong csdl myCommand.Connection = myConnection; myCommand.CommandText = sql;//gan commandtext = cau lenh sql //thuc hien chong Injection { myCommand.Parameters.Add(par); } myDataAdapter.SelectCommand = myCommand; //thuc thi cau lenh sql //Doc du lieu myDataAdapter.Fill(myDataset); // dien du lieu vao DataSet myDataAdapter.Dispose(); } //cap nhat CSDL VAO - Inset,update,delete { myConnection.Open(); SqlCommand myCommand; myCommand.Connection = myConnection; myCommand.CommandText = sql; myCommand.CommandType = commandType; { myCommand.Parameters.Add(par); } myCommand.ExecuteNonQuery(); } }