Page 1 of 1 1
Topic Options
#69252 - 2002-08-20 11:57 PM MS Access Database vs. Kix 4.10
badboii Offline
Fresh Scripter

Registered: 2002-03-07
Posts: 32
Loc: Seattle, WA
Hello all,

The following code works with 4.02 but DOESN'T work with 4.10. 4.10 is deployed and currently being used on our network. To get this inventory system to work I have to call a separate batch file to use the 4.02 version of wkix32.exe. This makes the logon sequence much longer and noticable. Can you gurus look at the code and tell me what I'm doing wrong? [Confused] [Confused] [Confused]

code:
;***** Begin Inventory
;Retrieve info by calls to WMIQuery() function

$uptime= WMIQuery("LastBootUpTime","Win32_OperatingSystem")
$wmientry=''+SubStr($uptime,5,2)+'-'+SubStr($uptime,7,2)+'-'+Left($uptime,4)+' '+SubStr($uptime,9,2)+':'+SubStr($uptime,11,2)+':'+SubStr($uptime,13,2)
? @SERROR

$SystemManufacturer = WMIQuery("Manufacturer","Win32_ComputerSystem")
? @SERROR

$SystemModel = WMIQuery("Model","Win32_ComputerSystem")
? @SERROR

$SerialNo = "$TagID"
? @SERROR

$VideoCard = WMIQuery("Description","Win32_VideoController")
? @SERROR

$VideoRes = WMIQuery("VideoModeDescription","Win32_VideoController")
? @SERROR

$PhysicalMemory = Val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024
? @SERROR

$ProcessorSpeed = WMIQuery("CurrentClockSpeed","Win32_Processor") + " Mhz"
? @SERROR

$PagefileSpace = Val(WMIQuery("TotalPageFileSpace","Win32_LogicalMemoryConfiguration"))/1024
? @SERROR

;Enumerate all disk info into arrays, then cross-reference for required info
$arrDeviceIDs = Split(WMIQuery("DeviceID","Win32_LogicalDisk"),"|",-1)
$arrFreeSpaces = Split(WMIQuery("FreeSpace","Win32_LogicalDisk"),"|",-1)
$arrTotalSizes = Split(WMIQuery("Size","Win32_LogicalDisk"),"|",-1)
$arrFormats = Split(WMIQuery("FileSystem","Win32_LogicalDisk"),"|",-1)
For $Counter = 0 To Ubound($arrDeviceIDs)
If $arrDeviceIDs[$Counter] = "C:"
$C_DriveFormat = $arrFormats[$Counter]
$C_DriveFreeSpace = $arrFreeSpaces[$Counter]
$C_DriveTotalSize = $arrTotalSizes[$Counter]
$Counter = Ubound($arrDeviceIDs) + 1
EndIf
Next

; -- Switch the order of the Full Names
$NumCharsInFullName = Len(@FULLNAME)
$LocationOfWhiteSp = InStr(@FULLNAME," ")
$lastN = SubStr(@FULLNAME,1,($LocationOfWhiteSp - 1))
$firstN = SubStr(@FULLNAME,$LocationOfWhiteSp,($NumCharsInFullName - $LocationOfWhiteSp) + 1)
$fullName = Ltrim($firstN) + Chr(32) + Rtrim($lastN)

$CHECK_ENTRY_USERS = "SELECT * FROM TBL_USERS WHERE USERNAME='@USERID';"

$DATABASE = "\\it-fserver\temp\inventory97.mdb"
? @SERROR

$DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; UID=; PWD=; DBQ=$DATABASE"
? @SERROR

$objConn = DBConnOpen($DSN,15,15)
? @SERROR

$recordset = DBRecordsetOpen($objConn,'$CHECK_ENTRY_USERS',,'3','3')
? @SERROR

;Create new record if none exists to update
If $recordset.RecordCount < 1
$recordset.AddNew
? @SERROR
EndIf

; CODE DIES RIGHT HERE!!!!!
; ERR: Object referencing a closed or invalid connection.) [-2147352567/80020009]UserName
; Script error: unknown OR unexpected command [.Value]! $recordset.Fields("UserName").Value = @USERID
$recordset.Fields("UserName").Value = @USERID
? @SERROR
$recordset.Fields("FullName").Value = $fullName
? @SERROR
$recordset.Fields("Workstation").Value = @WKSTA
? @SERROR
$recordset.Fields("PrivilegeLevel").Value = @PRIV
? @SERROR
$recordset.Fields("LastUpdate").Value = @DATE + " " + @TIME
? @SERROR

;Update the new record and close the recordset object
$recordset.Update

$RC = DBRecordsetClose($recordset)

$RC = DBConnClose($objConn)

_________________________
========================== Brian Zamora Computer Technician brian_zamora@hotmail.com ==========================

Top
#69253 - 2002-08-21 04:07 PM Re: MS Access Database vs. Kix 4.10
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Yes, it's a known problem with KiXtart 4.10+ and right now the DB... UDFs are only compatible with KiXtart 4.02. I'm working on fixing them to make them compatible with all 4.x versiosn.
_________________________
There are two types of vessels, submarines and targets.

Top
#69254 - 2002-08-22 12:25 AM Re: MS Access Database vs. Kix 4.10
badboii Offline
Fresh Scripter

Registered: 2002-03-07
Posts: 32
Loc: Seattle, WA
Thanks I needed to know that.
_________________________
========================== Brian Zamora Computer Technician brian_zamora@hotmail.com ==========================

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 262 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.052 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org