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.Controls; 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 14851
what is the syntax code for oldb to connect oracle?2 3756
When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
how to keep track of index in listbox items.2 4736
How do we invoke queries from the application2 3335
What is meant by executenonquery?
What is an example of ordinal data?
Which method in OLEDBAdapter is used to populate dataset with records?
What are the rules to implement connection pooling?
Name which operations can you not perform on an ado.net dataset?
How can I retrieve two tables of data at a time by using data reader? Data reader read and forward only, how is it possible to get 2 tables of data at a time?
Give few examples of datareader that is used in different dataproviders.
Describe briefly an ADO.NET Dataset ?
What is the difference between executenonquery () and executescalar ()?
What is the difference between statement and preparedstatement interface?
How to identify the updated rows in a dataset?
Why is stored procedure used in ado.net?
What is linq and entity framework?
What are the essential features of ado.net?