Im extremly new to C# and i have a datagridview polpulated already but would like to know how i can delete a row in SQL using the datagridcontrol. I can delete a row from the datagridview but i want to apply that to SQL server db table too. Can anyone help?
I can specify the connection, DataAdaptor etc but im stuck after that. I would need to create A SQL DELETE command and update at the end but thats all i know
private void btnDelete_Click(object sender, EventArgs e)
System.Data.SqlClient.SqlConnection cnn = new System.Data.SqlClient.SqlConnection();
conn = new SqlConnection(@"Data Source=<SQLInstance>;Initial Catalog=<Database>;Integrated Security=True");
da = new SqlDataAdapter();
ds = new DataSet();
datagridview1.Rows.RemoveAt(datagridview1.CurrentRow.Index); //applys delete to the gid but i want to delete the record in SQL too