i am using windows forms application with MSAccess.... i got da开发者_开发技巧ta from database table successfully but when i am trying to add data with (') character i got the exception that "OLEDB Exception: Syntax error(Missing Operator)inquery expression" ... Now how can i solve this problem? Plz tell me the solution of this problem....
all characters are accepted but apostrophe character only got error...
Thanks in Advance
This is not realted to MsAccess - the ' is a string delimiter in SQL.
Look at the SQL satement you submit to the database and you will find out it may look something like
SELECT FROM Users WHERE NAME LIKE 'mc'donald'
and
'mc'donald'
has a '
too much.
You need to escape those ('mc''donald') OR - better - use parameters.
Also read up on SQL Injection Attacks - the basics there tell you a lot about how to properly deal with databases.
精彩评论