Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO read double Records from AccessDB

Status
Not open for further replies.

homeless

Programmer
Nov 6, 2001
20
CH
Hello together,

I try to read float and double(precision 12) Values from my Access Database. For float values it works fine, but i can't get the double values:

the table: "Achsen", column with long values: "nIndex",
column with double values: "nWert"
Code:
char *sqlquery = "SELECT nIndex, nWert FROM Achsen WHERE nAchse=2;";

_RecordsetPtr rec;
    rec = cdb->Execute(sqlquery);
        while(!rec->EndOfFile) {

               long Value = (long)
rec->Fields->GetItem(_variant_t("nIndex"))->Value;
            }

               double Value = (double)
rec->Fields->GetItem(_variant_t("nWert"))->Value; // das hier geht nicht

rec->MoveNext( );
}
[\code]

thx for your replies!
 
1. Check up loop structure. There's a strange while w/o MoveNext.
2. You can't get DB NULL value in double. Add isnull test in your code.
 
yah, your movenext is in the wrong spot, it looks like your code would never end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top