Skip to content
Advertisement

Syntax error while doing C# SQL data insert

I am using the above code for data entry into SQLite database, but while getting some string values, I am getting this error:

‘SQL logic error near “da”: syntax error’

What is the reason ?

Advertisement

Answer

You will get SQL syntax error if one of rehberIsmi, jsonData contains single quote.

In your case, composing SQL query by concatenating strings is not a good idea. please use parameters

see details here https://docs.microsoft.com/en-us/dotnet/standard/data/sqlite/parameters

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement