Why are use ToString method ?
For example
cmd = new SqlCommand("Delete from Emp where Empid=" + DataGrid1.DataKeys[e.Item.ItemIndex].ToString(), con);
but not use in VB
cmd = New SqlCommand("Update Emp Set Empname='" & name.Text & "',EmpAdd ='" & add.Text & "'where Empid=" & DataGrid1.DataKeys(e.Item.ItemIndex), con)
VulpesPosted Sep 9, 2014, 6:43 AM
However, you should find that if you leave out .ToString() from the C# code, then it should work just as well as the VB code - ToString will be applied automatically.