3
Answers

Quotation error on SQL query

yokzu

yokzu

13y
2.7k
1
Hello,
Im using a form program that connecting to a access db.  It is working normally. But when I use " ' " in SQL query, Im getting;

Syntax error in string in query expression 'na'me'.

This is SQL injection problem I think but I dont how to solve?

...
 while (dongu < satir_sayisi)
  {
  string query = "SELECT * FROM name WHERE name='" + str[dongu] + "\'";
  OleDbCommand komut = new OleDbCommand(query, conn);
  OleDbDataReader rdr;  ---> error on this line
  rdr = komut.ExecuteReader();
...
Answers (3)
0
Jaganathan Bantheswaran

Jaganathan Bantheswaran

NA 25.7k 2.2m 13y
Hi,

Have you added the image in project. If yes , Is it .png format. If no, try with .png format images or different formats.
Accepted
0
Suthish Nair

Suthish Nair

NA 38.4k 4.6m 13y
Gira Palmer, Is this a kind of spamming or promoting your product. Either of the way is not allowed here, your login credentials will get blocked. We have Announcements section where you can post about your product etc..
Next Recommended Forum