MFC CRecordset via MySQL ODBC updates/deletes only first record in table
Greetings,
i've got the following problem:
I'm using Visual C++ CRecordset class to work with MySql database. When I want to update row with the following code, it does not update any row exept for the first row in table.
sSQL.Format(_T("SELECT * FROM Symbol WHERE PK=%d"), nID);
if(records.Open(-1, sSQL))
{
records.Edit();
records.SetSymbol(sSymbol);
records.Update();
}
For example when I have following rows:
1 f
2 d
3 h
the code above works for 1 row but does not work for other. Also the same behaviour is for Delete - I can delete first row, then second, but I can not delete second row at first. Moreover, There is no error.
Does anybody have ideas why?
Table:
CREATE TABLE `symbol` (
`PK` tinyint(3) NOT NULL auto_increment,
`n_symbol` char(1) NOT NULL default '',
PRIMARY KEY (`PK`),
UNIQUE KEY `id` (`PK`),
UNIQUE KEY `n_symbol` (`n_symbol`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Best regards,
Andrei
Subject
Written By
Posted
MFC CRecordset via MySQL ODBC updates/deletes only first record in table
May 16, 2005 04:56PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.