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 15004Post New Mind Tree ADO.NET Interview Questions
What is Infopath forms?
What is the file extension for a feature file?
What is difference between arraylist and list in java?
How much will flex builder 3 cost?
How to delete browser cookies with selenium web driver?
please send the last 5 years {{{JUNIOR ENGINEER GRADE II - MECHANICAL RRB CHENNAI}}} TECHNICAL question papers
What are the different types of measures in the modeling view?
Does python support switch or case statement in Python? If not what is the reason for the same?
How would you create Visual basic Document file?
What is pig latin statements?
How many types of files are there?
How do I edit text in a jpeg image in powerpoint?
What is the difference between string and string in c#?
What are lvalue and rvalue?
What is your view of project management?