reidy_boy
asked on
UPDATE in ODBC
When using Open() to run a database query with ODBC, it appears that only SELECT can be used in the query string. I tried using UPDATE, and it returned debug assertion error dbcore.cpp line 3282. However, when I call CanUpdate(), it returns true.
I once read that in order to make record changes on your database, you first need to do a SELECT query, set the new values in your program and exchange the data. Is this correct? If so, it seems long-winded. Is there a way that UPDATE can be used instead?
I once read that in order to make record changes on your database, you first need to do a SELECT query, set the new values in your program and exchange the data. Is this correct? If so, it seems long-winded. Is there a way that UPDATE can be used instead?
Does the ID you are using in the ODBC have permissions to do an update on the database?
If so you should just be able to do an update no problem.
If so you should just be able to do an update no problem.
ASKER
I have attached the cpp and h class files, and the code snippet that contains the update query.
AcmeCorporation.h.txt
CRecordset PositiveResultSet(theApp.GetDatabase() );
CDBVariant Variant;
TCHAR Message[2000];
if (sAcmeConfig[ACME_STAFF_COLUMN] == "")
return;
sprintf (Message, "UPDATE LECTDETS SET AcmeMiles='10' WHERE SetId='2008/2009' AND LecturerId='ESN'");
PositiveResultSet.Open(CRecordset::snapshot, Message);
AcmeCorporation.cpp.txtAcmeCorporation.h.txt
Try to use CRecordset::dynaset instead of CRecordset::snapshot
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please post your code so we can see?