Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MaxDB - Everything about MaxDB, formerly known as SAP DB
MySQL++ - Programming with the C++ API to MySQL
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
Problem with update.

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