Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    2

    Question Unanswered: OLEDB vs ODBC results

    I've got an ASP (classic) web app I programmed about 3 years ago and have developed continuously so it's fairly robust. I just switched from ADO/ODBC to OLEDB and I'm getting different resulting recordsets for a very specific query and I'm not sure why. This is simplified but very repeatable and I've definitely ruled out code bugs.

    Table A:
    column: ID int not null identity
    column: Name varchar (255)

    Table B:
    column: aID int not null
    column: bID int not null

    Table B is totally empty (no records)

    Query:
    Code:
    select * from [Table A] left join [Table B] on [Table A].ID = [Table B].aID
    Results:
    When using ADO/ODBC my recordset returns with all the items in Table A and nulls in the Table B columns.

    When using OLEDB, my recordset returns with *no* records.

    But then if I change the "*" to "count(*)" like so:
    Code:
    select count(*) from [Table A] left join [Table B] on [Table A].ID = [Table B].aid
    then OLEDB *does* return the correct record count.

    I've tried all sorts of variations and still can't get it. Ideas?

    Thanks

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Why not try replacing the asterix (*) with the column names you want to select?
    George
    Home | Blog

  3. #3
    Join Date
    Sep 2007
    Posts
    2
    i've tried it - even ensuring that they are listed as tablename.columnname just to be sure. same results.

  4. #4
    Join Date
    Sep 2006
    Posts
    265
    I too use OLEDB however all my SQL statements are from Queries in the database. The feilds, joins and criteria are all internal. I don't use Select * anywhere rather:

    Select MyQuery.ID, MyQuery from MyQuery etc

    Simon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •