Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ODBC SQLGetData does not work with more than 3 fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-01 : 08:49:03
Charles Gamble writes "I have been trying to use SQLGetData via C++ to return data from SQL
Server.
I have a database table declared as below:
CREATE TABLE dbo.TESTTABLE1 (
FIELD1 smallint NOT NULL ,
FIELD2 smallint NOT NULL ,
FIELD3 smallint NOT NULL,
FIELD4 smallint NOT NULL ,

)
GO

insert into TESTTABLE1 values(1, 2, 3, 4)

When I select more than 3 fields and use SQLGetData I get an
{"[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index"} error.
Note, it works fine with 3 fields only but with more than 3 I always
get this error.
It also does not matter what types the fields are.
I ensure that I retrieve the fields in the correct order.

Anyone have any idea why this is happening?
I have also tried to use SQLBindCol with the first 3 fields and
SQLGetData with the last one and I get the same error again.
Note, using SQLBindCol with every field works fine.

Thanks a lot
Charles Gamble."
   

- Advertisement -