Problem with update.

Problem with update.

am 24.04.2006 10:43:06 von p_romm

------=_NextPart_000_000B_01C6678B.DEAF3FE0
Content-Type: text/plain;
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

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.=20

I set statment:=20
SQLSetStmtAttr(hstmt,SQL_ATTR_CURSOR_SCROLLABLE,(SQLPOINTER) SQL_SCROLLABL=
E,0);=20
SQLSetStmtAttr(hstmt,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)SQL_CU RSOR_DYNAMIC,=
0);=20
SQLSetStmtAttr(hstmt,SQL_ATTR_CONCURRENCY,(SQLPOINTER)SQL_CO NCUR_LOCK,0);=
=20

I bind col:=20
SQLBindCol(hstmt,1,SQL_C_SLONG,&ret,0,&cb);=20

I fetch row:=20
SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);=20

I change ret value=20
and I try update row:=20
SQLSetPos(hstmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);=20

And then I get exception:=20
"Unhandled exception at 0x1004c170 in odbc_test.exe: 0xC0000005: Access =
violation reading location 0x00000000."=20

When I change SQL_LOCK_NO_CHANGE to SQL_LOCK_EXCLUSIVE=20
I get odbc error:=20
"[MySQL][ODBC 3.51 Driver][mysqld-5.0.18-max]Invalid cursor position"=20
code: "HY109"=20

When I use MS SQL Server and it's driver everthing works. The same code, =
table and data.=20


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
------=_NextPart_000_000B_01C6678B.DEAF3FE0--