I'm using DBCommand to collect data from workstations that execute a script. Each execution writes to 2 separate tables, and I'm finding that they don't always get written to. I noticed in looking at the UDF it has a section for paramaters and wondering if the $adLockReadOnly = 1 might be part of my problem? Is it OK to modify these parameters?
Code:
; default database parameters
$adStateOpen=1
$ConnTimeout=15
$CmdTimeout=30
$adCmdText = 1
$adOpenStatic = 3
$adLockReadOnly = 1
Or is it possible I'm using it incorrectly? Here is the section of the code that writes the data:
Code:
$dsn='DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\\servername\servershare\dbdirectory\migrate.mdb'
$CHKMigUser="SELECT COUNT (MigUser) FROM MigUsers WHERE MigUser='$userid'" ; add? -> AND MigDate='$MigDate'"
$CHKMigComputer="SELECT COUNT (MigComputer) FROM MigComputers WHERE MigComputer='$wksta' AND MigDate='$MigDate'"
$MigAMAmountAM="SELECT Count (MigComputer) FROM MigComputers WHERE (MigDate='$MigDate') AND (MigTime='AM')"
$MigAMAmountPM="SELECT Count (MigComputer) FROM MigComputers WHERE (MigDate='$MigDate') AND (MigTime='PM')"
$MigUsers="INSERT INTO MigUsers (MigUser,LDomain,MigComputer,MigDate,MigTime)VALUES('$userid','$LDomain','$wksta','$MigDate','$MigTime')"
$MigComputers="INSERT INTO MigComputers (MigComputer,CDomain,User,MigDate,MigTime,StepReached,OS,NTBased,LocalAdmin,GrpAddReturn) VALUES('$wksta','$CDomain','$userid','$MigDate','$MigTime','$StepReached','$OS','$InWin','$LAdmin','$grpadd')"
If $LDomain<>"ActiveDirectory" ;check that user isn't already logging in to ActiveDirectory
$recordset = DBCommand($dsn,$Migusers) ; populates user data
$MessageText1="User Acct Migration: Scheduled for $MigDate."
Else $MessageText1="User Acct Migration: User currently logged in to ActiveDirectory, no migration needed!"
Endif
$recordset = DBCommand($dsn,$CHKMigComputer) ;check uniqueness of computer/migdate
$RecordUnique=+$recordset[$row,$column]
If $RecordUnique<1
$recordset = DBCommand($dsn,$MigComputers) ; populates computer data
Else $MessageText="Computer Migration: ALREADY scheduled for migration on $MigDate!"
Endif
IF $MigTime=AM ; this section runs only for AM migrations to do max 99 users
$recordset = DBCommand($dsn,$MigAMAmountAM) ; retrieve number of AM computer migrations
$AMAmount=$recordset[$row,$column] ; $AMAmount equals the number of current AM migrations
IF $AMAmount >79 ;if more than 99 migrations, write flag file to prevent any future additions
$nul=redirectoutput("\\servername\servershare\dbdirectory\"+$migdate+""+$migtime+".flg",0)
? $AMAmount
$nul=RedirectOutput("")
ENDIF
Endif
IF $MigTime=PM ; this section runs only for PM migrations to do max 1500 users
$recordset = DBCommand($dsn,$MigAMAmountPM) ; retrieve number of PM computer migrations
$AMAmount=$recordset[$row,$column] ; $AMAmount equals number of current PM migrations
IF $PMAmount >=599 ;if more than 600 migrations write flage file to prevent any future additions
$nul=redirectoutput("\\servername\servershare\dbdirectory\"+$migdate+""+$migtime+".flg",0)
? $AMAmount
$nul=RedirectOutput("")
ENDIF
Endif