I need to use manual crud in my context.
How do I get the values of the cells in the row being update.
1) The first two lines of code above is what I use to implement in radgrid for asp. How do I get those values in this context winforms?
2) I also have added a delete button column. I do I code the event to delete the row where the button is clicked?
Thanks
How do I get the values of the cells in the row being update.
private void radGridView1_CellEndEdit(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
//TextBox t1 = RadGridView1.MasterGridViewInfo.CurrentRow.Cells("Company").Value.ToString();
//TextBox t2 = RadGridView1.MasterGridViewInfo.CurrentRow.Cells("something").Value.ToString
{
using (var cn = new SqlConnection(connString))
{
cn.Open();
try
{
SqlCommand cmd = new SqlCommand("UPDATE myTable SET Column = @Parm1 WHERE Col = @Parm2", cn);
var parm1 = cmd.CreateParameter("Parm1");
parm1.Value = t1.Text;
var parm2 = cmd.CreateParameter("Parm2");
parm2.Value = t2.text;;
cmd.Parameters.Add(parm1);
cmd.Parameters.Add(parm2);
int rowsAffected = cmd.ExecuteNonQuery();
}
catch (SqlException ex)
{
//MessageBox.Show(ex.StackTrace);
}
}
}
}
1) The first two lines of code above is what I use to implement in radgrid for asp. How do I get those values in this context winforms?
2) I also have added a delete button column. I do I code the event to delete the row where the button is clicked?
Thanks