Results 1 to 9 of 9

Thread: simple sql query !

  1. #1
    Guest
    whats wrong with this sql ::
    select * from DTDC_Service_Offices where city like 'A*' order by city, branchname

    in MS Access its resulting in 30 records but when fired from VB its returning 0 records, is there any problem with the * sign or what is it ? can't figure it out.
    thanx

  2. #2
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    Your code, as entered here, is correct. It will return records as requested. If you are returning 0 records, you might check to ensure that there is not an imbedded space before the "A". It's either something like that or you have no cities beginning with "A" :-).

  3. #3
    Guest
    i have cities beginning with A, but this query is not working with VB....... can't figure it out still !!

  4. #4
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    Kan -

    Just to make sure I haven't completely lost it, I took one of our tables with plenty of records and ran your sql against it; it came out just fine. Then, I created the same sql, but "accidentally" threw in a space after the apostr (' A*'). I got 0 records returned. I tried a number of other times, using other spurious chars. Each one gave me 0 records.

    Try using a copy-paste to put your code here (don't type it). Let's see if there IS a spurious char.

  5. #5
    Guest
    i tried copy pasting it ........ still giving 0 records
    and there's no space before A

  6. #6
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    Paste it here using the
    Code:
    'code goes here
    tags

  7. #7
    Guest
    code-----

    i've a variable mysql which contains
    mysql="select * from DTDC_Service_Offices where city like 'A*' order by city, branchname"

    Set rsDtdc = rc.OpenResultset(mysql, rdOpenKeyset, rdConcurRowVer)

    and its returning 0 records

  8. #8
    Lively Member
    Join Date
    Nov 2000
    Posts
    82
    Kan-

    Can you show me how you set your environment and connection? Additionally, why use RDO for an Access database? DAO is so much simpler and less prone to error.

  9. #9
    Guest
    Public re As rdoEnvironment
    Public rc As rdoConnection

    rdoEngine.rdoDefaultCursorDriver = rdUseClientBatch
    Set re = rdoEngine.rdoEnvironments(0)
    re.CursorDriver = rdUseOdbc
    Set rc = re.OpenConnection("courier", Connect:="uid=; pwd=sandy")


    there's an odbc set named 'courier' for the databade

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