-
October 9th, 2009, 06:48 AM
#1
Updating DB using MFC
Hi all,
I am struggling with one of my system's modules which is I need to edit filed's value in the data source depending on some variables.
My problem is I stuck with Recordset type because I making the editting via SQL statment and the following which are I done so far:
CDatabase DBDecaying;
CString SqlRulesDecaying;
CString sDriver("MICROSOFT ACCESS DRIVER (*.mdb)");
CString sDsn;
CString ssDSN("ODBC;DRIVER={%s};DSN='';DBQ=%s");
CString sFile("c:\\DB\\db.mdb");
sDsn.Format(ssDSN, sDriver, sFile);
DBDecaying.Open(NULL,false,false,sDsn);
CRecordset RecSetRulesDecaying( &DBDecaying );
int X=2,Y=3;
double NewActiLevel = 0;
SqlRulesDecaying.Format(_T("update Rules set RActiLevel=%f where CNum=%d and RNum=%d"),NewActiLevel,X,Y);
RecSetRulesDecaying.Open(CRecordset::forwardOnly,SqlRulesDecaying,CRecordset::??????);
So what I should put insted of ???? I tried (Update,Can Update,..) but I had syntax errors.
So please any help will be appreciated.
Best regards.
-
October 9th, 2009, 07:37 AM
#2
Re: Updating DB using MFC
Have you tried the default?
Also, forwardOnly makes your recordset read only. Try snapshot or dynaset instead.
-
October 9th, 2009, 08:16 AM
#3
Re: Updating DB using MFC
Yes I tried dynaset ,snapshot and dynamic and they are not working as well.
Last edited by hijjawi; October 9th, 2009 at 08:25 AM.
-
October 9th, 2009, 09:22 AM
#4
Re: Updating DB using MFC
Originally Posted by hijjawi
Yes I tried dynaset ,snapshot and dynamic and they are not working as well.
You need to be more specific about what "not working" means.
-
October 9th, 2009, 09:39 AM
#5
Re: Updating DB using MFC
I means that no changes occurs on the field.
please any help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|