private void SavedataGridTable() { ConnLibrary conn = new ConnLibrary(); using (SqlCommand sqlcomm = new SqlCommand()) { for (int i = 0; i < dgrLoadGrid.Rows.Count - 1; i++) { strNameS = dgrLoadGrid[0, i].Value.ToString(); intPrice = Convert.ToInt32(dgrLoadGrid[1, i].Value); intQuantity = Convert.ToInt32(dgrLoadGrid[2, i].Value); dteNow = dateTimePicker1.Value; sqlcomm.Connection = conn.Connection; sqlcomm.CommandType = CommandType.StoredProcedure; sqlcomm.CommandText = "usp_SaveSale"; sqlcomm.Parameters.Add("@Name", SqlDbType.NVarChar, 50).Value = strNameS; sqlcomm.Parameters.Add("@Price", SqlDbType.Int).Value = intPrice; sqlcomm.Parameters.Add("@Quantity", SqlDbType.Int).Value = intQuantity; sqlcomm.Parameters.Add("@Date", SqlDbType.Date).Value = dteNow; sqlcomm.ExecuteNonQuery(); MessageBox.Show("Sale Done"); } } }
for (int i = 0; i < dgrLoadGrid.Rows.Count - 1; i++) { using (SqlCommand sqlcomm = new SqlCommand()) { ... // the code as it is
MessageBox.Show("Sale Done");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)