How To Update A Column In A DataGrid Using C#.NET? I am getting InvalidCastException as (Specified cast is not valid) while updating 2nd column in a datagrid? Id,firstname,lastname are the three columns of my datagrid respectively. I wanted to edit the second column(lastname) and update it. I did the following code in DataGrid's updatecommand(),but failed to update ! Int varid=(int)DataGrid1.DataKeys[e.Item.ItemIndex]; TextBox lnm=(TextBox)e.Item.Cells[2].Controls[0]; string str=lnm.Text ; SqlCommand cmd=new SqlCommand("update customer set lastname='" + str + "' where id=" + varid + "",con); cmd.ExecuteNonQuery(); DataGrid1.EditItemIndex=- 1; DataGrid1.DataBind();
2 16176When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
HCL,
5 11637
What is aggregating data ?
What is the difference between oledb sql server and oledbdotnet provider?
What is difference between ado.net and asp net?
What are datareaders?
What is the difference between Dataset. clone and Dataset.copy?
How do you update a dataset in ado.net and how do you update database through dataset?
How to work with disconnected data - the dataset and sqldataadapter?
how Sequence to connect and retrieve data from database using dataset?
Define different execute methods of ADO.NET command object ?
Which control of the BindingNavigator returns the current position within the data source?
Which object holds only data and does not interact with data source?
Which is faster sqldataadapter and sqldatareader?
In how many ways we can retrieve table records count? How to find the count of records in a dataset?
What does ole stand for in excel?
What are the essential features of ado.net?