If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > OLEDB vs ODBC results

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-07, 22:32
BrianMD73 BrianMD73 is offline
Registered User
 
Join Date: Sep 2007
Posts: 2
Question 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
Reply With Quote
  #2 (permalink)  
Old 09-20-07, 03:43
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Why not try replacing the asterix (*) with the column names you want to select?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 09-20-07, 08:19
BrianMD73 BrianMD73 is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 09-20-07, 08:34
SimonMT SimonMT is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On