Hiroshimator reciently inspired me to get into the wonderful world of ADO (ActiveX Data Objects). You need to have it installed on your computer. If not it will tell you such.

This is working on my Win98SE, but i have not tested it on any other machine. If you could download and play with it, and lemme know your machine as well as if it worked or not, it would be apprechiated ;)

How the GUI works:

    [*]A new XML database file will be created on C:\ASM_DB.XML evertime you run
    [*]It will be formated to four generic text fields, and set to have three records
    [*]Lastly it will be saved and closed, and you will be given the GUI to work with.
    [*]Open opens this file again
    [*]Close closes this file again
    [*]Update will save any field changes to the current record
    [*]Add will add a new record to the end of the database
    [*]Delete will delete the current record
    [*]First moves to the beginning of the database
    [*]Prev moves to the previous record
    [*]Next moves to the next record
    [*]Last moves to the last record
    [*]Save saves back to the file C:\ASM_DB.XML any modifications you have done. Note that they will be destroyed the next time you run the example. If your currious about the XML file, open it in an editor.


    This example only creates one file at all times. However, when your finished with it, you will have to manually delete it from C:\.

    Thanks for your help. I aim to eventually work this into a RadASM add-in utility, and i will be releasing a number of OOP classes regarding ADO and related stuff in the near future as well..

    Regards,
    :NaN:
Posted on 2003-08-28 21:43:51 by NaN
Seems to work fine in Win2K SP4. I got no errors at any rate and everything worked as expected.
Posted on 2003-08-28 21:52:11 by donkey
Thats a good sign ;)

Im pretty happy with it, i plan on either replacing, or (if i have the source) reworking the Snippets add-in, to allow more ogranization, and searching features.

Should be a worthy first-time practical project using this. The four fields are to be: Topic, Function, Notes, and Code respectively.

I tested it by placing the entire source in the multiline edit, one record per file, and it handled it no problem.

At anyrate, thanks for the Win2000 confirmation
:alright:
Regards,
:NaN:
Posted on 2003-08-28 22:03:19 by NaN
This thing seems out of date :grin:
telling me i dont have ado 2.5 installed. The newest version of microsofts MDAC active x library is already version 2.7 (thats what i have installed)
so i cant run it :(

would have been interesting, cause i am a DB programmer myself (but not in asm :tongue: )
Posted on 2003-08-28 22:25:43 by Ranma_at
Same for me: ADO 2.5 not installed.

If I look with COMView I see ADO versions 2.0, 2.1, 2.5, 2.6 and 2.7 being installed. From there I have no problems creating a RecordSet object with ADO 2.5.

Japheth
Posted on 2003-08-28 22:28:18 by japheth
Hmm.. wierd..

Im loading the CLSID from registry as "ADODB.Recordset.2.5"

I will make it the standard "ADODB.Recordset"

Perhaps this will work. Below is the same thing revised to this...

Thanks for your help!
:alright:
NaN
Posted on 2003-08-28 22:46:47 by NaN
is running now ;) (on xp pro)
Posted on 2003-08-28 22:59:16 by Ranma_at
Still fine here.
Posted on 2003-08-28 23:09:39 by donkey
Works fine on WinNT4 WS SP6a + ADO 2.6
Posted on 2003-08-29 02:48:41 by Morris
I have ADO 2.1 . Win98SE. I get this:

ADO caused an invalid page fault in
module <unknown> at 0084:00000001.
Registers:
EAX=00000000 CS=0167 EIP=00000001 EFLGS=00010246
EBX=0063fc04 SS=016f ESP=0063fa54 EBP=0063fa90
ECX=d0b50860 DS=016f ESI=0116f92c FS=40ff
EDX=1f34b6d8 ES=016f EDI=005100ac GS=0000
Bytes at CS:EIP:
00 00 00 00 00 00 00 16 00 04 0a 65 04 70 00 65
Stack dump:
004024f9 0116fbf0 00510a4c 00000008 00000000 00000000 0000000a 00000000 80020004 00000000 0116f92c 0063fbb8 00510a4c 00510a08 0116fbf0 0063fbb0


the previous sample showed the message "ADO 2.5 not installed"
Posted on 2003-08-29 04:06:26 by Ultrano
Yes.. thanks for pointing this out. Since i made the modification from "Recordset.2.5" to just "Recordset", it allowed the COM to instanciate *whatever* version you what. I was relying on the the previous descriptor to filter out non-compliant versions.

I will have to wip up some test code to now check the version as well... (no biggy, i guess its the price i pay to take short cuts...)

Thanks for testing!
:NaN:
Posted on 2003-08-29 12:41:28 by NaN
NaN,

I simple check the CurVer key for minimum version check. It should be easy to parse "ADODB.Recordset.2.7" for want you need.

Regards, P1 :cool:
Posted on 2003-08-29 13:48:35 by Pone
Ok... Hopefully this should handle all cases.

It will accept any registered values from HKCR\ADODB.Recordset\CurVer == "ADODB.Recordset.2.5" or greater (.2.6, .2.7).

Could all who have tested once before, try this version, and let me know how it turns out, and what version your running ( i worked in a popup box to let you know what it finds for you ;) )

Thanks again!
:alright:
NaN
Posted on 2003-08-29 19:33:40 by NaN
Hi NaN,

Works fine - 2KSP4 ADODB.Recordset Version 2.5.
Posted on 2003-08-29 20:43:16 by donkey
Hi, works on XP, V2.7.

Theoretically it shouldnt be necessary with COM to do version checks by hand. In the type library there exist (at least) 2 recordset iids, one beginning with 00000555- (RecordSet21), the other beginning with 00000556- (_RecordSet). I guess that you wont get a valid interface pointer to _RecordSet with ADO version 2.1.

Japheth
Posted on 2003-08-30 00:04:30 by japheth
:grin:
It works for me now (at ado version 2.1)
msgbox, Your Version Is:, ADODB.Recordset.2.1
msgbox, Error, You do not have ADO v2.5 installed
exit
Posted on 2003-08-30 02:14:06 by Ultrano
The first one you posted and the last one both work fine with Win98osr2, MDAC 2.5
Posted on 2003-08-30 07:42:43 by djinn
Excellent, At least i now have a working template for furture projects.

Japheth, thanks for pointing this out. I looked at the COM object class itself for a version property, but i only found it in the IConnection interface. Im still learning ADO in some respects, so i didnt want to trust this out right. Doing it "by hand" wasnt much of a chor at all, i used my CString.Compare to determing it:
    invoke RegOpenKeyEx,    HKEY_CLASSES_ROOT, addr szC_L_S_I_D2, 0, KEY_READ, addr hKey

.if( ! eax )
mov hStr, $NEW( CString, NULL )
invoke RegQueryValueEx, hKey, 0,0,0,0, addr keySize

METHOD hStr, CString.AllocBuffer, keySize
mov keySize, $EAX( hStr, CString.GetLength )

invoke RegQueryValueEx, hKey, 0,0,0, $EDX( hStr, CString.GetAddr ), addr keySize
.if( eax == ERROR_SUCCESS )

METHOD hStr, CString.UpdateBuffer
invoke MessageBox, NULL, $EDX( hStr, CString.GetAddr ), CStr("Your Version Is:"), MB_OK
METHOD hStr, CString.Compare, addr szC_L_S_I_D3
.if( eax > 1 ) ; Less than

jmp @Fail

.endif

.endif
invoke RegCloseKey, hKey
DESTROY hStr
.endif


where CLSID2 = "\ADODB.Recordset\CurVer
and CLSID3 = "ADOBD.Recordset.2.5"

:alright:
NaN
Posted on 2003-08-30 09:15:41 by NaN
Hi, anyone can upload de source again?.

Greets and thanks.
Posted on 2005-02-17 03:27:22 by r00t