943,635 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 923
  • VB.NET RSS
Oct 9th, 2008
0

SQL Error Display Event Form

Expand Post »
Helo friends;

VB.NET Syntax (Toggle Plain Text)
  1.  
  2. If lbDriverName.SelectedIndex = True Then
  3. sql = "SELECT * FROM tblDriver WHERE dName =" & lbDriverName.SelectedItem
  4. Else
  5. sql = "SELECT * FROM tblDriver"
  6. End If

and my error is...

<br />
<br />
Syntax error (missing operator) in query expression 'dName ='.<br />
<br />

where dName is the column in access table.
please hlp.
thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hisheeraz is offline Offline
9 posts
since Oct 2008
Oct 9th, 2008
0

Re: SQL Error Display Event Form

Try

VB.NET Syntax (Toggle Plain Text)
  1.  
  2.  
  3. sql = "SELECT * FROM tblDriver WHERE dName ='" & lbDriverName.SelectedItem"'"

I think that should work - you have to have the whole statement surrounded by double quotes but to add the selected item I think you put it within double quotes within single quotes . . .

maybe this post helps:

http://www.daniweb.com/forums/post700733.html
Last edited by rapture; Oct 9th, 2008 at 3:54 pm. Reason: add other forum post
Reputation Points: 155
Solved Threads: 41
Posting Whiz in Training
rapture is offline Offline
294 posts
since Jul 2007
Oct 9th, 2008
0

Re: SQL Error Display Event Form

thanks...solved with missing & sing in ur sql expression.
Last edited by hisheeraz; Oct 9th, 2008 at 4:27 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hisheeraz is offline Offline
9 posts
since Oct 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Smart phone emulator
Next Thread in VB.NET Forum Timeline: Guessing Game





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC