If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > ADO Recordset Open Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-12-03, 02:30
jchimutanda jchimutanda is offline
Registered User
 
Join Date: Dec 2003
Posts: 5
Question ADO Recordset Open Error

Hi People,

I have a ADO recordset i want to open as follows:

sql1 = "select * from Receipts where Custname ='Jack'"
rs.CursorLocation = adUseClient
rs.CursorType = adOpenForwardOnly
rs.LockType = adLockReadOnly
rs.Open sql1, cn

The code above works fine. I'm trying to be more flexible and give the user a text box to provide the own name to search. So I have a textbox called txtCustname.
I modify my code to the following:
sql1 = "select * from Receipts where Custname =txtCustname.txt "
rs.CursorLocation = adUseClient
rs.CursorType = adOpenForwardOnly
rs.LockType = adLockReadOnly
rs.Open sql1, cn

I get the error msg "No value given for one or more required parameters" with rs.Open sql1,cn highlighted.

Where am I getting lost? Thanks for all your replies.
Reply With Quote
  #2 (permalink)  
Old 12-12-03, 02:40
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Modify the following:

sql1 = "select * from Receipts where Custname =txtCustname.txt "

with:

sql1 = "select * from receipts where custname = '" & txtCustname.txt & "'"

You need to put single quotes around strings.
Reply With Quote
  #3 (permalink)  
Old 12-12-03, 03:21
jchimutanda jchimutanda is offline
Registered User
 
Join Date: Dec 2003
Posts: 5
Talking It Worked!

Perfect! That Worked. Thank You!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On