Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Error 1

Status
Not open for further replies.

MinnisotaFreezing

Programmer
Jun 21, 2001
120
KR
Hey all, I'm getting a "Invalid Attribute/Option Identifier" error in a MessageBox after the NewSet.Update() line of the following code
Code:
CDatabase m_dbCust;
	m_dbCust.Open( NULL, FALSE,
               TRUE, _T("ODBC;DSN=dynacom"), FALSE);
	AccPay NewSet(&m_dbCust);
	NewSet.m_strFilter = "";
	NewSet.Open();
	NewSet.Edit();
	NewSet.m_DynacomPO = 12.00;
	NewSet.Update();
	NewSet.Close();
The Open() works fine, and I get connected to the database and get the data I expect, but the update fails. I set the last argument of CDatabase::Open to FALSE to specifically not load the cursor library because I am trying to update a MS Access table with more than 40 fields, and that fails with the cursor library according to MSDN. However, I have tried using the above code to update a table with <40 fields, and I still get the error &quot;Invalid Attribute/Option Identifier&quot; Can anyone help with this, or give me an idea on how to update a table with 40+ fields using CDatabase?

Thank you in advance,

CJB
 
use an update table... query Ion Filipski
1c.bmp


filipski@excite.com
 
Ion,

Do you mean like this?

CString SQLstr = &quot;UPDATE AccountsRec SET DynacomPO = 999 WHERE DynacomPO = 20&quot;;
m_dbCust.ExecuteSQL(strCmd);

CJB
 
I assume you did Ion, because I got it to work. Thank you very much. Looking at this also helped me realize the problem with my posted code, namley my third flag was set wrong, but also that ODBC returns an error of &quot;Recordset is read only&quot; if you try and edit a snapshot recordset with the cursor library not loaded, a quirk not very well documented by MSDN I do not think. Anyway, thanks again for your help, Tek-Tips saves my a## again.

CJB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top