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 16289When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
HCL,
5 11821
Which is faster datareader or dataadapter?
Which is better ole db or odbc?
How to identify the updated rows in a dataset?
What is bubbled event?
Give few examples of datareader that is used in different dataproviders.
What is ado rdo dao in visual basic?
Command objects uses, purposes and their methods.
What is the difference between data grid and data repeater?
How to creating a SqlCommand Object?
What is connection in ado.net?
What is aggregating data ?
What is an ado?
What is sql command in ado net?
How we can provide data to ado.net?
How can we serialize the dataset object?