how to get the rowset by using ODBC API function

From: wanghg (wanghg_at_public.ty.sx.cn)
Date: 08/17/04


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



Relevant Pages

  • Re: G76 parameter line
    ... esp w/ the older controllers....the controller ... (where your "M" codes are concerned)....often the MTB will decide ... the buffer is executed IIRC. ... the control can execute much of anything. ...
    (alt.machines.cnc)
  • Re: [Lit.] Buffer overruns
    ... If there is perfection then, by definition, ... correctness (absence of buffer overruns) ... for such codes ultimately get ... features are available?) ...
    (sci.crypt)
  • Re: sprintf_s() functions different in vc2008 and vc2005?
    ... They said this feature can be turned off by calling: ... It is because my company want to migration all C++ codes into vc2008, ... your code shouldn't lie to the function about buffer size. ...     Igor Tandetnik ...
    (microsoft.public.vc.language)
  • Re: Why OnComm Event for MSComm control is not triiggered after a XON handshaking signal is sent?
    ... > there any wrong in my codes? ... > 'Send Xon signal. ... XOFF is sent by the receiving side when its buffer is xx% full, ... signal the sender that it should pause. ...
    (microsoft.public.vb.winapi)
  • Re: SUMIF with 2 conditions
    ... the second sheet is a summary page. ... > colum g contains the department number and colum h contains the product ... > can input a deprtment number and then a list of all the product codes ...
    (microsoft.public.excel.worksheet.functions)

Loading