-2

I have tried this code but it shows syntax error cant select * from tbl2 were like 1, 1999 I do that because ccont may match on the database and I have a delete code depend on it so if 2 ccont matches it deletes them both I want to check it with ccont and modelnumbb so it won't get deleted

string coe = "DELETE * FROM tbl2 WHERE ccont , modelnumbb LIKE '" + textBox2.Text + "%','" + mdlnumber3.Text + "%'";

Yawar Murtaza
  • 3,655
  • 5
  • 34
  • 40

1 Answers1

0

% is not standard wildcard character in Access query. The WHERE clause syntax is wrong. Try:

string coe = "DELETE * FROM tbl2 WHERE ccont LIKE '" + textBox2.Text + "*' AND modelnumbb LIKE '" + mdlnumber3.Text + "*'";

Might want to explore use of parameters to prevent SQL injection. Review How does the SQL injection from the "Bobby Tables" XKCD comic work?

June7
  • 19,874
  • 8
  • 24
  • 34