i posted something related to this a few days ago and i am successfully connected to a database through ODBC in Visual Studio. even though i am in the win32 environment using ODBC(ODBC driver 3.5.1) i have to use this to make sure i have portability. anyway thats the situation.
for those of you that have experience reading data and displaying it from a database i would love your help.
here is my SQL statement: SELECT * from variables.
the variables table looks like this:
variable_id variable_name min max
10 name 1 0 10000
11 name 2 0 1
12 name 3 0 100
13 name 4 3 9
thats the general form of it.
i am trying to use a SQLBindCol to print out the first column but i am getting a weird print out when i print the results to a file.
SQLPOINTER name; //variable name
SQLPOINTER id; //variable id
sr = SQLBindCol(hstmt, 1, SQL_BIGINT, id, SQL_NTS, NULL);
if(sr != SQL_SUCCESS && sr != SQL_SUCCESS_WITH_INFO)
output << "failed binding" << endl;
output << "binding successful" << endl;
while (SQLFetch(hstmt) == SQL_SUCCESS)
output << id << endl;
output is just an ofstream.
my output is supposed to print out the first every row with the first column and i get this: