Results 1 to 2 of 2

Thread: Space in SQL statement?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Posts
    55

    Question 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!!

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    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:
    1. if not rst.eof then
    2. '---- your code here to display/read
    3. end if
    This checks if you have one record (or more) returned then allows it to read that records fields.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    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
  •  



Click Here to Expand Forum to Full Width