<asp:LinkButton ID="lblDelete" CommandArgument='<%# Eval("mus_id") %>' CommandName="DeleteRow" runat="server">Delete</asp:LinkButton>
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName == "DeleteRow")
{
SqlConnection cs = new SqlConnection("Data Source=DESKTOP-3T94FQ0;Initial Catalog=RAMS;Integrated Security=False;UID=sa;Password=sa123;");
SqlCommand deleteCommand = new SqlCommand("DELETE FROM [tbl_musannet] WHERE [mus_id]= @mus_id",cs);
deleteCommand.Parameters.Add("@mus_id", SqlDbType.BigInt).Value = Convert.ToInt64(e.CommandName);
cs.Open();
deleteCommand.ExecuteNonQuery();
cs.Close();
}
}
But when I going to delete rows "Input string was not in a correct format" error is showing.
Please help.
Thanks