Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After doing a Find recordSet loses data.

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
I do a find like this:

tempVar1 = "P" & j
recSet2.Find "PackID Like '" & recSet(tempVar1) & "'"

Before this, my recordset is full of data, I know this because for now I have some test code that prints it all to screen. After I do the find, all my recordset has is the field names. This is how I am creating the recordset:

set recSet2 = Server.CreateObject("ADODB.Recordset")
recSet2.open tempStr, strC, adOpenStatic

This works from my XP test box, but not our 2000 IIS Server. Any ideas why this happens?
 
You have a find statement thats looking for something "LIKE" without any wildcards.. So basically you are doing a search for an exact match..

Try this:

recSet2.Find "PackID Like '%" & recSet(tempVar1) & "%'"
or
recSet2.Find "PackID Like '*" & recSet(tempVar1) & "*'"

One of those should produce the results your looking for.

Cheers.

 
K, this is my recordset before I find:

PackID ProductID ProductLayoutPath
DBW Z-11-B-F-25 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-
CBW Z-11-B-F-45 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-B-F-45.txt
BBW Z-11-B-F-57 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-B-F-57.txt
ABW Z-11-B-F-80 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-B-F-80.txt
H Z-11-C-F-14 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-14.txt
D Z-11-C-F-25 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-25.txt
C Z-11-C-F-45 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-45.txt
B Z-11-C-F-57 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-57.txt
A Z-11-C-F-80 \\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-80.txt

As you can see, I have records where the PackID is exactly A. When I search with a wildcard, I get ABW as the result, when I do a find for A itself (no wildcards) I get nothing. Now, on my XP testbox I am using the same SQL 2k database. For some reason, the search is working differently on the Win2k production server. Can't figure out why. I checked to see if maybe there were spaces before or after 'A', but there were none.
 
I'm sorry, there are leading spaces. Hmm... I placed quotes and parenthesis in the ASP code to show exactly what comes up in the recordset. As you can see, every Value in the recordset has an extra space at the end. Now, I went into the database earlier to see if there were spaces, and made sure there were none, why are theses spaces appearing?

('C ') ('Z-11-C-F-45 ') ('\\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-45.txt ')
('B ') ('Z-11-C-F-57 ') ('\\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-57.txt ')
('A ') ('Z-11-C-F-80 ') ('\\Dell2400\KPDP2\Layouts\FORMAT SENIORS\Z-11-C-F-80.txt ')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top