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();
...
Quotation error on SQL query
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Dorababu MekaRank #457 · 5.5K reputationPosted Jun 6, 2011, 4:10 AM EDT
string query = "SELECT * FROM name WHERE name='" + str[dongu] +"'";
Suthish NairRank #92 · 22.8K reputationPosted Jun 6, 2011, 4:12 AM EDT
Parameterized Query and SQL Injection Attacks
Suthish NairRank #92 · 22.8K reputationPosted Jun 6, 2011, 4:14 AM EDT