|
-
Aug 12th, 2004, 08:15 PM
#1
Thread Starter
Member
Space in SQL statement?
Hi, can anyone fix the space problem in my sql statement? I am getting this error message:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
This is my sql statement:
sql = "SELECT * FROM " & tblname & " WHERE " &Col& " = N'" &Var& "' AND [Show]=1 ORDER BY [Code] ASC"
And I am passing the parameters to the url something like this:
Product.asp?Visit=Yes&Var=Hong%20-%20Kong&Col=Place
Problem is that most of my data contain a space (eg. Hong Kong).
I don't have this error when my data is single word (eg. Sydney)
Please help!!
-
Aug 13th, 2004, 04:00 AM
#2
Check what the value is when Asp sees it.. if its a string and %20 then use the Replace function to replace all %20s with spaces. Then use that in your sql statement.
The error is probably that you are referencing field data but you don't have a record. You should put :
VB Code:
if not rst.eof then
'---- your code here to display/read
end if
This checks if you have one record (or more) returned then allows it to read that records fields.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|