I'm connection to an access database (Access 2000) through ODBC. (code came from this board)
I can do a select query on the database, but when I replace the select with an insert, I get assertion errors.
This thing is driving me nuts for the past days.
The connection with the db works because of the select statements are working just fine.
I did not create my own version of CRecordset, I don't know if I should? I saw some tutorials where they create a classe that inherits from CRecordset, but I never got that to work properly.
here's some code:
g_mydb is my database (a global CDatabase)
the first query works, the second gives assertion failures.
does it has something to do with the way you open the recordset? (forwardOnly etc.)Code:CRecordset rs(&g_mydb); strSQL.Format( "SELECT COUNT(nr) FROM woorden WHERE duits='"+m_german+"'" ); rs.Open( CRecordset::forwardOnly, strSQL ); rs.GetFieldValue( (short)0, strField ); rs.Close(); strSQL.Format( "INSERT INTO woorden ( duits, nederlands, geslachtduits, geslachtned, hoofdstuk ) VALUES (\"Shnee\", \" sneeuw\", \" 1\", \" 1\", \" 2\");"); rs.Open( CRecordset::dynamic, strSQL ); //rs.GetFieldValue( (short)0, strField ); rs.Close();
I tryed all of them and none worked
Thanks
Maes



LinkBack URL
About LinkBacks




.