Note that there are some explanatory texts on larger screens.

plurals
  1. POexactly what does the statement handle(hstmt) do? in ODBC
    primarykey
    data
    text
    <p>I`m new to write c code for ODBC but here I have question... after searching for the tutorial for odbc function tutorials for C, I still caanot get exactly how they work collaborately...</p> <p>what does the statement handle hstmt exactly do for database data? I knew it controls the SQL query statements that I give as a parameter. but,, then every SQL statements that i give as query should have each statement handle(hstmt) for each of them? or one statement handle for several SQL query statements?</p> <p>for example,</p> <pre><code>lstrcpy((LPTSTR)update, L"insert into employee values ('Dshong','summer','LosAngeles');"); SQLExecDirect(hstmt1, update, SQL_NTS); lstrcpy((LPTSTR)update, L"insert into works values ('Dshong','Small Bank', 2500);"); SQLExecDirect(hstmt3, update1, SQL_NTS); lstrcpy((LPTSTR)select, L"select * from works;"); if (SQLExecDirect(hstmt, select, SQL_NTS) != SQL_SUCCESS) return printf("can’t exec direct"); lstrcpy((LPTSTR)select1, L"select * from employee;"); if (SQLExecDirect(hstmt2, select1, SQL_NTS) != SQL_SUCCESS) return printf("can’t exec direct"); </code></pre> <p>should I give like this for two insert statements and two select statements with four hstmt?</p> <p>and if I give like this,</p> <pre><code>lstrcpy((LPTSTR)insert, L"insert into employee values ('Dshong','summer','LosAngeles');"); SQLExecDirect(hstmt1, insert, SQL_NTS); </code></pre> <p>the SQLExecDirect has hstmt1 as parameter but I don`t know how SQLExecDirect works with it..</p> <p>And as I think, the result should be one line inserted, isnt it?</p> <p>but when I run the code, it inserts multi-same rows for <code>('Dshong','summer','LosAngeles')</code>... when I printed out the result, <code>('Dshong','summer','LosAngeles')</code> was inserted multiple times even though the insert line was not in the for loop or so...</p> <p>and how they work together with the functions below? </p> <ul> <li><code>SQLBindCol(hstmt, 1, SQL_C_CHAR, id, (SDWORD)sizeof(id), &amp;idlen);</code></li> <li><code>SQLFetch(hstmt)</code></li> </ul> <p>I know what they simply doing but.. here I want to know exactly in which way hstmt ( statement handle) work with them..</p> <p>thank you.. :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload