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 CRecordView.it still do not work. why? and How?
mrmzxwflAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

V_BapatCommented:
How do you open the database?
You have to open with bReadOnly = FALSE

0
vachoohoCommented:
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?
0
gothickCommented:
Is there a unique index on the table?  Some ODBC drivers/databases need that for updates.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

mrmzxwflAuthor Commented:
Hi!
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?
0
V_BapatCommented:
When you specify the option CRecordset::appendOnly, you are not allowed to edit or delete a record. You can only do AddNew.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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!
0
vachoohoCommented:
Do not use AX_DB_USE_DEFAULT_TYPE
use CRecordset::dynaset instead
0
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.