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 14998When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
HCL,
5 9816
What is the difference between ado.net and oledb?
What is difference between executenonquery and executequery?
What does adodb stand for?
What is executequery?
What are the disadvantages of using datalist?
how Sequence to connect and retrieve data from database using dataset?
What are all the different authentication techniques used to connect to MS SQL Server?
Which method in OLEDBAdapter is used to populate dataset with records?
Which one of the following objects is a high-level abstraction of the connection and command objects in ado.net?
How can we perform transactions in .net?
What is ado and dao?
how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....
Explain the architecture of ado.net?
Which object needs to be closed?
What are the several execute methods of ado.net?