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 14997When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
HCL,
5 9816
Which method is used by command class to execute SQL statements that return single value?
Why edit is not possible in repeater?
How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?
Some important instruction regarding ADO.NET connection string ?
Which database is the ado.net sql connection object designed for?
What is data control techniques?
If a table contains 20000 records . In a page at each time 100 records to be displayed what are the steps you will take to improve performance? Will you use dataset or datareader?
What is the functionality of data provider in ado.net?
Why is ADO.NET serialization slower than ADO ?
Is ado.net an orm?
What are the data access namespaces in .NET?
How does entity framework work?
How to find the given query is optimised one or not?
What is isolation?
What is DataRowCollection?