hi i am deleting a data in local database in c# visual studio but it gives an error in it. i have pasted here a function of deleting and a screen shot of error please help me to solve this.
public int drugDelete(string particulars)
{
try
{
string strCommand = "DELETE FROM IA WHERE Particulars='" + particulars;
SqlCeCommand cmdDelete = new SqlCeCommand();
cmdDelete.Connection = conn;
cmdDelete.CommandType = CommandType.Text;
cmdDelete.CommandText = strCommand;
return cmdDelete.ExecuteNonQuery();
}
catch (SqlCeException e)
{
MessageBox.Show(e.Source + "\n" + e.Message + "\n" + e.StackTrace);
return -1;
}
}
Loading
Hemant SrivastavaPosted Jul 8, 2014, 3:33 PM
Wajid UsmanPosted Jul 8, 2014, 3:26 PM
Hemant SrivastavaPosted Jul 8, 2014, 3:22 PM
Looks like you missed the quotation mark at the end:
string strCommand = "DELETE FROM IA WHERE Particulars='" + particulars + "'";