Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Replacement for Dao

691 views
Skip to first unread message

rajas

unread,
May 6, 2004, 11:43:42 AM5/6/04
to
Hello,

I need to 'update' an application that uses MFC Dao database classes - it
appears that this will not work in newer Windows & no longer supported. The
application uses Access or SQL server depending on the circumstances.

What is the best alternative - Still need to use VC 6 (not .Net). Need to
taking into account learning curve & 'longevity' of support. Performance is
also a consideration - though secondary. Most ADO examples in MSDN seem
to be .Net or VB, and OLE DB examples are even more limited.

I would appreciate any and all input. If there is already a place where
this has been discussed - I would appreciate if someone would point me to
it.

Thanks


Scott McPhillips [MVP]

unread,
May 6, 2004, 8:37:38 PM5/6/04
to
rajas wrote:

ODBC is probably a good answer for such an update. Since the
application is already using CDaoDatabase and CDaoRecordset, the
conversion would be almost as simple as substituting the ODBC CDatabase
and CRecordset classes. If that satisfies your definition of "best,"
ODBC is a widely used, DB-independent interface that is not controlled
by Microsoft, so it should have much better longevity than the Microsoft
library-of-the-year.

--
Scott McPhillips [VC++ MVP]

rajas

unread,
May 7, 2004, 1:19:17 AM5/7/04
to
Thanks Scott - I am looking into the classes even as I write this note.
CDatabase and CRecordset are MFC classes right? One of the considerations
is future migration away from MFC (looking to have a Windows CE version &
need application to be 'lighter' than it is now). So if I move to ODBC with
these classes - will I have one more migration, or can I take these classes
to ATL/WTL implementation - if that is the route we go.

"Scott McPhillips [MVP]" <scot...@mvps.org.nothere> wrote in message
news:euvpzM8M...@TK2MSFTNGP12.phx.gbl...

rajas

unread,
May 7, 2004, 11:59:02 AM5/7/04
to
Thanks,
I am looking into it as I write this. First look says that moving to ODBC
will certainly make the trasition easy. I take it that using the classes
CRecordset CDatabase will continue my dependency on MFC - one other thing I
am looking into the possibility of slowly moving into ATL/WTL to reduce
deployment issues across multiple versions of Windows


"Scott McPhillips [MVP]" <scot...@mvps.org.nothere> wrote in message
news:euvpzM8M...@TK2MSFTNGP12.phx.gbl...

Roy Fine

unread,
May 8, 2004, 2:27:57 PM5/8/04
to
Rajas,

you may have gotten a bit of bad info -- DAO still works, it is MFC that is
hardcoded to the DAO 3.5 version. DAO 3.6 works well with Jet 4 database
versions through Access 2000 for sure.

If you want to move away from DAO, then you should seriously consider ADO -
there are capabilities in ADO and ADOX that match DAO, while the ODBC
support is a bit weak (like not being able to create autonumber column, and
not being able to access the @@IDENTITY column, etc...)

regards
roy fine


"rajas" <ra...@cox.net> wrote in message
news:H2tmc.17865$ph.13348@fed1read07...

rajas

unread,
May 9, 2004, 8:44:23 PM5/9/04
to
Roy,
Thanks for the input.

The application (an MFC app) that I am looking at actually works well with
Access2000 - in fact the application checks to see if jet 4.0 is available
and uses AfxGetModuleState()->m_dwVersion = 0x0601; to work around the hard
coding in MFC. However, something in Office 2003 seems to break it.

As I wrote earlier, the application uses Jet database or SQL server. I read
that Jet actually provides ADO support through its ODBC (I am still looking
through examples in ODBC for Autonumber - seems a pain with need for
multiple accessor macros , as well as BLOB support for large text strings -
was straight forward in Dao) and hence ODBC may perform better than ADO.
Have not made a decision yet - but looks like I need to real soon.

"Roy Fine" <rlf...@twt.obfuscate.net> wrote in message
news:uouV1qS...@TK2MSFTNGP09.phx.gbl...

Roy Fine

unread,
May 9, 2004, 9:50:37 PM5/9/04
to
Rajas,

have you installed Jet 4, Service Pack 8. Here are a couple of links:

http://support.microsoft.com/default.aspx?scid=kb;en-us;829558

http://support.microsoft.com/default.aspx?scid=kb;en-us;825796


regards
roy fine


"rajas" <ra...@cox.net> wrote in message

news:EfAnc.19083$ph.708@fed1read07...

Roy Fine

unread,
May 9, 2004, 10:39:52 PM5/9/04
to
Rajas

I have to make sure that I was runing with a "real" 2003 format database, so
I created a new databse using Access 2003, and imported some data. I then
wrote a quick hack of a program to create a CDaoDatabase object and a
CDaoRecordset object, then open both and fetch from the database. All seems
to work ok - but I was using VC++ 7.1 (VS 2003).

regards
roy fine

(note - DAO is still available - but it has officially been moved to the
deprecated category - i.e. you should move to a new/supported technology
soon. There is no native support for Jet in .Net, so one could expect the
Jet Engine to be deprecated soon - in fact Jet will not be available at all
on 64 bit platforms, rather you have MSDE as the backend database engine)
rlf


Here is a snip of the code that I used:

/* ******************************************* */
BOOL CDAODoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;

CDaoDatabase *db;
CString db_2003_Path = "C:\\Documents and Settings\\Administrator\\My
Documents\\FastTalk3000_vA.mdb";
db = new CDaoDatabase();
db->Open(db_2003_Path);

CDaoRecordset *daorec = new CDaoRecordset(db);
daorec->Open(AFX_DAO_USE_DEFAULT_TYPE,"Select count(*) FROM names_master");
int reccnt = daorec->GetFieldValue(0).lVal;

daorec->Close();
db->Close();

delete daorec;
delete db;

return TRUE;
}
/* ************************************************** */

"rajas" <ra...@cox.net> wrote in message

news:EfAnc.19083$ph.708@fed1read07...

rajas

unread,
May 10, 2004, 5:26:23 PM5/10/04
to
The problem occurred in a customer's computer & our logging feature caught
that the program crashed in the first db call to open the database - it was
a brand new computer with XP-home & Office 2003. It is possible that the
version of Jet there did not have the latest service pack. We have a
customer base with computers from Win9x to WinXP and varying versions of
Office and some without Office. Occasionally we need to walk a win9x
customer through MDAC installs, though we have not bothered to get the
latest version for them. We will do some more testing - now that we know
that DAO may have some more shelf life.

"Roy Fine" <rlf...@twt.obfuscate.net> wrote in message

news:uVg%23YijNE...@TK2MSFTNGP10.phx.gbl...

0 new messages