how to get the rowset by using ODBC API function
From: wanghg (wanghg_at_public.ty.sx.cn)
Date: 08/17/04
- Next message: Mikeshi: "Headache problem with CRecordset"
- Previous message: John C. Frickson: "ADO Problem - No Data Returned"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Aug 2004 09:19:12 +0800
I want to get rowset by using ODBC API function. I wrote some codes as
below:
SQLChar strSQL[100];
SQLINTEGER id[10],len;
SQLCHAR NAME[10][50];
SQLRETURN rtcode;
strcpy(strSQL,"select trunk_line_id,trunk_line_name from trunk_line");
rtcode=SQLAllocHandle(SQL_HANDLE_STMT,hdbc,&hstmt); //allocate the statment
handle
rtcode=SQLSetStmtAttr(hstmt,SQL_ATTR_CURSOR_TYPE,(void*)SQL_CURSOR_STATIC,0)
;
rtcode=SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)10,SQL_IS_IN
TEGER);
rtcode=SQLExecDirect(hstmt,(SQLCHAR *)strSQL,SQL_NTS); //execute the SQL
statement
//bind the colum to the buffer,
SQLBindCol(hstmt,1,SQL_C_SLONG,id,sizeof(long),&len);
SQLBindCol(hstmt,2,SQL_C_CHAR,NAME,50,&len);
rtcode=SQLFetchScroll(hstmt,SQL_FETCH_NEXT,10);//fetch the rowset
........
The above code was executed correctly, but the result was not correct. I
dont know why, I am very eager to get some advices.
thanks
- Next message: Mikeshi: "Headache problem with CRecordset"
- Previous message: John C. Frickson: "ADO Problem - No Data Returned"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|