i have data in my gridview , now how to Update and Delete Data With DataGridView
below code is for geeting data in gridview its working fine :
private void findlaksajob_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
string sql = "SELECT [Jobcard],[Planqty],[Mouldqty],[Operator],[Supervisor],[Profilename],[Process],[Date],[Remark],[Approvedby],[id],[Division],[Od] FROM [SAPProduction].[ProductionData] WHERE JobCard ='" + findlaksajob.Text.ToString() + "'";
SqlDataAdapter da = new SqlDataAdapter(sql, objConn1);
DataSet ds = new DataSet();
objConn1.Open();
da.Fill(ds, "ProductionData");
dataGridView2.DataSource = ds;
dataGridView2.DataMember = "ProductionData";
objConn1.Close();
e.Handled = true;
}
}
Dorababu MekaPosted Dec 1, 2012, 6:34 AM
check this example
http://www.c-sharpcorner.com/UploadFile/rohatash/insert-edit-update-and-delete-data-with-datagridview-in-wi/