I'm right, I was wrong!
It's not an ODBC issue, so it (must?)/might be a kix COM syntax thingie...
Still confused about why dbopenrecordset() fails, and will continue to pursue it.
In the meantime, I have a workaround - just execute an sql insert into the database. It ain't purty (yet) but it works using this 'development' code...
code:
; notes: - sql reserved names include date and time.
; - changed db field names date to currentdate and time to currenttime
; - sql string values should be in 'single quotes', *not* "double quotes"
;
;*********** make a db connection *************************
$db = "c:\program files\kixtart\kixdatabase\swinv.mdb"
$cn = createobject("adodb.connection")
$cn.connectionstring = "data source=$db; provider=microsoft.jet.oledb.4.0;persist security info=false"
$cn.open()
;
;*********************** get the inventory data and write it to the db ***********
$array = GetUninstallInfo()
$vardate=@date
$vartime=@time
$varwksta=@wksta
For Each $varapp in $array
$rs = $cn.execute("insert into inventory (computername,program,currentdate,currenttime) values ('$varwksta','$varapp','$vardate','$vartime')")
;? "insert : @error @serror"
next
;
;************************ read it back from the db ****************
$rs = $cn.execute('select * from inventory')
while not $rs.eof()
? $rs.fields("currentdate") ":" $rs.fields("currenttime") "-" $rs.fields("computername") " " $rs.fields("program")
$rs.movenext
loop
;***************** clean up and go home ***********************************
$cn.close()
$cn = 0
exit 1
;******************************
Function GetUninstallInfo()
dim $Index, $Key, $RC, $Value, $RootKey
dim $progs[0]
$Index = 0
$RootKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
$Key = EnumKey($RootKey, $Index)
While @Error = 0
ReDim PRESERVE $progs[$Index]
$RC = EnumValue($RootKey + $Key, 1)
If @Error = 0
$Value = ReadValue($RootKey + $Key, "DisplayName")
If $Value = ""
$Value = ReadValue($RootKey + $Key, "QuietDisplayName")
If $Value = ""
$Value = $Key
EndIf
EndIf
Else
$Value = $Key
EndIf
$progs[$Index] = $Value
$Index = $Index + 1
$Key = EnumKey($RootKey, $Index)
Loop
$GetUninstallInfo = $progs
EndFunction
bleonard...
Refer to clpowell's original post that started this thread re database structure...
In my incarnation
The database name is swinv.mdb
The table name is inventory
The field names are computername,program,currentdate,currenttime
and my database weapon is MS Access 97
Cheers...