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 16044When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
HCL,
5 11431
What are the connected and disconnected modes in ado.net?
What is row state?
How would you connect to database using .NET?
How will you fill the gridview by using datatable object at runtime?
What is openquery?
How do you find the count of records in a dataset?
What are the namespaces used in ADO.Net to connect to a database?
Which method is used to sort the data in ADO.Net?
What is difference between connected and disconnected architecture in ado.net?
How do you update database through dataset?
What is Serialization in .NET? what are the types of Serialization?
Explain the difference in record set and dataset?
What is the full form of ado.net?
How to maintain the relation between two tables in ADO.NET?
What is ado net stands for?