Problem with update. 2006-04-24 - By p_romm
Back Hi,
I had a problems with updating rowset. I use odbc driver ver. 3.51.12 on WinXp and I couldn't update any row.
I set statment: SQLSetStmtAttr(hstmt,SQL_ATTR_CURSOR_SCROLLABLE,(SQLPOINTER)SQL_SCROLLABLE,0); SQLSetStmtAttr(hstmt,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)SQL_CURSOR_DYNAMIC,0); SQLSetStmtAttr(hstmt,SQL_ATTR_CONCURRENCY,(SQLPOINTER)SQL_CONCUR_LOCK,0);
I bind col: SQLBindCol(hstmt,1,SQL_C_SLONG,&ret,0,&cb);
I fetch row: SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
I change ret value and I try update row: SQLSetPos(hstmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
And then I get exception: "Unhandled exception at 0x1004c170 in odbc_test.exe: 0xC0000005: Access violation reading location 0x00000000."
When I change SQL_LOCK_NO_CHANGE to SQL_LOCK_EXCLUSIVE I get odbc error: "[MySQL][ODBC 3.51 Driver][mysqld-5 (See http://qld-5.ora-code.com).0.18-max]Invalid cursor position" code: "HY109"
When I use MS SQL Server and it's driver everthing works. The same code, table and data.
I found that the problem was with binding columns. My sql query took all columns from the table and i only bind one column. Is any way to take columns and bind not all ?
Thanks for comments. Roman
|
|