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 16194Post New Mind Tree ADO.NET Interview Questions
What is piping?
What do you understand by Linear Regression in R?
What is the use of activex?
hiiiiiiiiiiii i am a person of G.C(general category) and i want to attempt the lic delelopment officer test . i have done mba in marketing and i am agency holder of lic for 3 years. am i elligible for this test .or this test is only for s.c/b.c persons please tell me sir ,,, mailme at mohit.rimt@gmai.com,mohitrimt@in.com
How to set a page as a home page in a php based site?
What are the main features of datastage?
What is the difference between local and central version operating modes?
SAP supports MDX, where as SAPBO supports SQL,,, like is there any major and more difference between SAP and BO?...please ans to this quetion.
what are the MEPs available in WCF?
What is string manipulation in R?
Name some frameworks in Java to implement SOAP web services?
Define Single block activity in UiPath?
What are different types of valves?
How many availability zones are in azure?
What is the difference between vlookup and index match?