PDA

Click to See Complete Forum and Search --> : ADO addnew Problem


CornedBee
May 5th, 2002, 10:58 AM
I don't know ADO, only DAO (I heard they are pretty similar in concept).

Could it be that the MoveLast call in GetNewKey screws something up? Will m_rsRecSet be altered when you call m_pRs->MoveLast? And why don't you use the excellent DAO support in MFC?

BTW, you should use _tcscpy when working with windows, just like you should always use TCHAR instead of char and wrap all strings with _T("string"). This makes it easy to convert your app to UNICODE support. (Far better language support for strange character sets (Greek, Russian, Japanese, ...) and slightly better performance on WinNT, required for WinCE)

Andreex
May 5th, 2002, 11:08 AM
Thanks for answering CornedBee. I am learning ADO b/c I have read it is the latest connectivity and above all.... thats what it comes in the book I bought... :)

I alredy tried not using the GetNewKey function. m_rsRecSet is an object from a class that works as an interface. What is it weird is that after puttin the data directly to its vars.... it takes the ones from the window's controls. I dont get it. I dont update that data into the interface object... so why does it do it? if right after i put the clean data, I add it to the database. But guess what? It doesnt add it. It tries to add it when I move to another register.

Oh well.. I will keep searching...
hey..if you have a nice example of DAO, would you post the code or something?

Thank you

CornedBee
May 5th, 2002, 11:40 AM
I don't have an example of DAO. I use it heavily, but what I do can't really serve as an example. (I could post my document class, but it would only confuse you.)

If ADO works like DAO, you would first call AddNew, then set the values and then call Update...

A look at the reference supports my view, but I hate both the DAO and the ADO reference because they're both made for VB. This is another reason why I like the MFC DAO support: the reference is for C++...