SQL Error Display Event Form

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2008
Posts: 9
Reputation: hisheeraz is an unknown quantity at this point 
Solved Threads: 0
hisheeraz hisheeraz is offline Offline
Newbie Poster

SQL Error Display Event Form

 
0
  #1
Oct 9th, 2008
Helo friends;

  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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 276
Reputation: rapture has a spectacular aura about rapture has a spectacular aura about 
Solved Threads: 37
rapture rapture is offline Offline
Posting Whiz in Training

Re: SQL Error Display Event Form

 
0
  #2
Oct 9th, 2008
Try

  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 9
Reputation: hisheeraz is an unknown quantity at this point 
Solved Threads: 0
hisheeraz hisheeraz is offline Offline
Newbie Poster

Re: SQL Error Display Event Form

 
0
  #3
Oct 9th, 2008
thanks...solved with missing & sing in ur sql expression.
Last edited by hisheeraz; Oct 9th, 2008 at 4:27 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC