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 16184When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
HCL,
5 11663
What is the use of SqlCommandBuilder?
What are the data providers in ADO.NET framework?
What are datareaders?
Define bubbled event?
What are the usages of the command object in ado.net?
What is the procedure to call a Stored Procedure of Back End in ADO (ActiveX Data Object) and RDO (Remote Data Objects)?
Which is the feature of ado.net?
What is read only and forward only in ado.net?
What is ambient transaction?
What is connection in ado.net?
What is the use of ADO.NET and XML web services?
Give an example of a .net application which connects to microsoft access database using ado.net classes.
Define connection string?
Can we load multiple tables in a dataset?
Can we connect two dataadapters to same data source using single connection at same time?