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 14947Post New Mind Tree ADO.NET Interview Questions
Say you knew a company's net income. How would you figure out its "free cash flow"?
what is the difference between Delete and Truncate command in SQL
You want to change the system passowrd. How would you do it?
IN A PN JUNCTION DIODE,( ON FORWARD BIAS ) WHEN ELECTRONS AND HOLES PAIRS MADE AND CURRENT FLOWS,THEIR IS NO END OF ELECTRONS AND HOLES IN A LITTLE SEMICONDUCTOR DEVICE.
Once the system determined the item level schedule line category automatically in the sales order, can you still change it manually?
What is the difference between delete and destroy ?
Inline the values in PL/SQL, what does it mean.?
Can you explain the role of a rheumatologist and the focus of their practice within the field of medicine?
What is xml serialization in c#?
What are the benefits/ advantages of Cassandra?
What does a Bode plot tell you?
What do you mean by dusk used in laravel 5?
Can you explain the co>operating system’s processing model?
Does hashmap allow null keys?
Which Join type will be in use it gives the outcome of only those records which were common in both the tables?