Re: Visual Basic & SQL Problem.

From: Paul Krikorian <paulk_at_uhura.dis.cccd.edu>
Date: 12 Jul 1994 00:13:45 GMT
Message-ID: <2vsn7p$9bn_at_spock.dis.cccd.edu>


In article <2vsg4b$d7i_at_crl3.crl.com>, Michael Natale <mnatale_at_crl.com> wrote:
>I am using Visual Basic ODBC to access Oracle 7. Everything is working
>except for one SQL statement:
>
> select dept, sum(col_1), sum(col_2), sum(col_3)
> from desired_table
> group by dept;
>
>This command works fine in SQLDBA, but visual basic will give all the
>summed columns the same value, why? (And no, these are not the real
>table and column names...)
>
>Mike Natale

Mike,
  You don't specify exactly how you go about retrieving the data from   Oracle, but here at CCCD we are using the CreateSnapShot method and   we've found what we think is a bug in the way VB works. If you try   to select values from columns with the same name (from different   tables, of course) in a single select statement, VB will only return   the value from the first column with that name   (i.e. string$ = set.Fields("col")) even if you specify the column   number instead of the column name. Also, preceeding the column name   with the table name will result in an error. I suspect that VB sees   your sum'd columns all with the same column name.

-- 
Paul Krikorian                   | Internet: paulk_at_uhura.dis.cccd.edu
Coast Community College District |           (or paulk_at_cccd.edu)
1370 Adams Ave.                  |    Voice: (714) 432-5150
Costa Mesa, CA 92626, USA        |      Fax: (714) 432-5062
Received on Tue Jul 12 1994 - 02:13:45 CEST

Original text of this message