Wajid Usman

Wajid Usman

  • NA
  • 34
  • 10.5k

Delete in Local Database.

Jul 8 2014 3:19 PM
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;
            }
        }

Attachment: error.rar

Answers (3)