Previous Thread

8/4/2006 3:46:40 PM    Problem with bulk insert
the code copied below  throwsthis  error 
 
(val of ret is -2 
 
Total Number of diagnostic records: 0) 
 
I'm trying to do a bulk insert. 
 
column1 and column2 are both char [20][50] 
 
I can loop through these arrays and see their are values in them. 
 
The columns I'm trying to insert into are both char 16. 
 
rowcnt is 20. 
 
I could probably work it out if I had an example, but I cannot find 
 
one. I hope someone can help me, 
 
Kate 
 
code snippet 
 
ret = SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER)rowcnt, 
 
SQL_IS_I 
 
NTEGER); 
 
ret = SQLBindCol( hstmt, 1, SQL_C_CHAR, column1, sizeof( column1[ 0 ] 
 
), indicat 
 
or1 ); 
 
ret = SQLBindCol( hstmt, 2, SQL_C_CHAR, column2, sizeof( column2[ 0 ] 
 
), indicat 
 
or2 ); 
 
printf("in insertpic\n"); 
 
ret = SQLExecDirect(hstmt, "INSERT INTO stk2 (stock, comp)   VALUES(?,? 
 
)", SQL_NT 
 
S); 
 
printf("val of ret is %d\n",ret);