Problem updating SQL Server through ODBC/CRecordset 
Author Message
 Problem updating SQL Server through ODBC/CRecordset

I've written a MFC-based application. It's supposed to update a SQL Server
database. I'm using ODBC to make my application database independant. I've
got a recordset that is derived from CRecordset. I open the database and
the recordset (as dynaset) and it works fine.

Problem:

When I call CanUpdate on my recordset it fails. It always returns FALSE. I
know the primary key has to be in the recordset, if it should be possible
to update SQL Server through ODBC, and it is. If I switch ODBC driver and
let my application use a Access database instead everything works ok. Any
ideas of what I have done wrong?

Version of Visual C++: 4.2b
Version of NT: 4.0
Version of SQL Server: 6.5
Version of SQL Server ODBC driver: 2.65.0240.

This is the way my code looks like:

recset.Open();

if(recset.CanAppend())
{
   fset.AddNew();

   recset.m_idrad = 1;
   recset.m_text   = "Just a sample";
   ...
   ...

   recset.Update();

Quote:
}

recset.Close();

Thanks in advance!

Magnus Granberg
IBM Global Services, Nordic
Sweden



Mon, 04 Oct 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Error updating SQL-Server record via ODBC (CRecordset)

2. SQL Server error when updating via CRecordset

3. SQL Server error when updating via CRecordset

4. How to pass NULL params in RFX for CRecordset in SQL Server/ODBC

5. Need ID of a record added to SQL-Server using MFC/ODBC/CRecordset

6. How to pass NULL params in RFX for CRecordset in SQL Server/ODBC

7. Problem with ODBC update using CRecordset

8. Help: Problems with CRecordset and SQL Server

9. SQL Server with CDatabase/CRecordset and server cursors

10. CRecordset and SQL Server Linked Server View

11. Help needed: problem in using odbc call to write binary data to SQL Server

12. problem with SQL Server ODBC drivers

 

 
Powered by phpBB® Forum Software