By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Syntax error (missing operator) in query expression 'Serial Number = 'L3FW341''.

P: 2
Syntax error (missing operator) in query expression 'Serial Number = 'L3FW341''.

The Serial Number field is declared as text in Access Db.
I am not sure which operator is missing in my command!

Below is my code:


Expand|Select|Wrap|Line Numbers
  1. Cmd1 = New OleDbCommand("Select * from Asset Details where Serial Number = 'L3FW341'", Conn)
  2.         Da = New OleDbDataAdapter(Cmd1)
  3.         Db1 = New DataTable()
  4.         Da.Fill(Db1)
Dec 26 '11 #1

✓ answered by Stewart Ross

You have spaces in your table and field names. Names with spaces must be enclosed within brackets, like this:

Expand|Select|Wrap|Line Numbers
  1. "Select * from [Asset Details] where [Serial Number] = 'L3FW341'"
-Stewart

Share this Question
Share on Google+
2 Replies


Expert Mod 2.5K+
P: 2,545
You have spaces in your table and field names. Names with spaces must be enclosed within brackets, like this:

Expand|Select|Wrap|Line Numbers
  1. "Select * from [Asset Details] where [Serial Number] = 'L3FW341'"
-Stewart
Dec 26 '11 #2

P: 2
Thanks Stewart, that worked. :)
Dec 27 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.