How to modify *.dbf(ODBC) ?

Base on the "MFC AppWizard" to make a simple progam.We can view the records of *.dbf with "previous record" and "next record".But when we modify the field in a editbox,the "can not update the database...,the object is read only" message was given.It is try to close the database and to open it again in the still do not work. why? and How?
Who is Participating?
V_BapatConnect With a Mentor Commented:
When you specify the option CRecordset::appendOnly, you are not allowed to edit or delete a record. You can only do AddNew.
How do you open the database?
You have to open with bReadOnly = FALSE

Do you have more than one table in the recordset;s query?

Look in CYOurRecordset::GetDefaultSQL() function. It should return complete SQL query or the name of ONE (or more) tables separated by comma.
Is there one table name?
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Is there a unique index on the table?  Some ODBC drivers/databases need that for updates.
mrmzxwflAuthor Commented:
We are glad to receive the instruct.
There is only one FoxPro database in the system.
The 32bit datasource diver is MS FoxPro driver V2.6.
The table name is student.dbf (setup with VFP6.0 )and no index.
After the AppWizard,the editbox was added in the dialog and added the variable refering to the m_pSet.(none any statement was edded by hand.)Then it works.
When the field was modified in the editbox,the message was given in the above.So you can see that all we do is the MFC default.
Then the table was closed by the m_pSet->Close,it is ok.Then m_pSet->Open() function with all default ,with dwOption=CRecordset::none,CRecordset=::appendOnly was used.The m_pSet->AddNew() was tried.It works,but can not update."... readonly ..." was given again.How to do?
mrmzxwflAuthor Commented:
Hi,V Bapat:
On the Open() function,the following attempted was tried:
(1)  m_pSet->Open();
(2)  m_pSet->Open(AX_DB_USE_DEFAULT_TYPE,NULL,CRecordset::none)
(3)  mpSet->Open(,,appendOnly),and AddNew()
The result is the same.We are wander about this.The table can be opened by the above method,for we can view the field correctly.But to modify or append is forbidden."... read only ..."!!!.
What's wrong with me?I have not changed the other part of the program after MS AppWizard.So the app is very simply.Help me!
use CRecordset::dynaset instead
mrmzxwflAuthor Commented:
Hello everyone.
  All advances was used.Thanks.The records can not be updated.I feel sorry for the question.The "...read_- only ..." or "Update or Delete fault!" was given when the field was edited or appended.What's wrong with me?
I need help!
All Courses

From novice to tech pro — start learning today.