K
Koen
Hello,
Another ADO problem with Windows PE 1.2. I'm using the script below to
update a record in an SQL database. Becouse Windows PE does'nt support ADO
in HTA files properly (so it seems), i had to use a regular vbs script. But
when i run this one it gives me an error that the class isn't registered, im
getting reeealy tired of running into this kind of errors, why say that
Windows PE supports ADO while it really doesn't do a good job!
Ok, i am still using Windows PE 1.2, with the new
'buildoptionalcomponents.vbs'. This is becouse Ms has not yet updated the
msvl website...
When i run the script it gives me code: 80040154 line: 34 char:1 error:
'Class not registered' source: provider
Thanks for your time and any help.
Koen.
This is the script: (don't mind the incorrect line brakes)
'Opiton Explicit
'On Error Resume Next
Dim Catalog, SQLQery1, PWD, USERNAME, SERVER, strREG
Dim objDBConnection, objRecordSet
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objShell = Wscript.CreateObject("Wscript.Shell")
'haal waarden op uit register
strBestand = objShell.RegRead("HKLM\Software\GWIS\Bestand")
strPartitie = objShell.RegRead("HKLM\Software\GWIS\Partitie")
strMacAdres = objShell.RegRead("HKLM\Software\GWIS\MacAdres")
strOmgeving = objShell.RegRead("HKLM\Software\GWIS\Omgeving")
strNaam = objShell.RegRead("HKLM\Software\GWIS\Name")
'Maak een connectie naar de database
set objDBConnection = Wscript.CreateObject("ADODB.Connection")
set objRecordSet = Wscript.CreateObject("ADODB.Recordset")
SERVER = "192.168.2.1"
USERNAME = "sa"
PWD = "password"
Catalog = "Images"
objDBConnection.ConnectionString = "Provider=SQLOLEDB;Data
Source="&SERVER&";Initial Catalog="&Catalog&";User
ID="&USERNAME&";Password="&PWD&";"
objDBConnection.Open
objRecordSet.CursorLocation = adUseClient
objRecordSet.ActiveConnection = objDBConnection
'This line below is line 34 in the script...
objRecordSet.Open "SELECT * From " & strOmgeving , objDBConnection,
adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
objRecordSet.Find = "Mac = '" & strMacAdres & "'"
If objRecordSet.EOF then
objRecordSet.MoveFirst
objRecordSet.Find = "Mac = 'leeg'"
If objRecordSet.EOF Then
strError = "Geen vrije station namen meer in de " & strOmgeving
& " omgeving."
Errors()
End If
objRecordSet("Mac") = strMacAdres
objRecordSet.Update
End If
strREG = objRecordSet("Naam")
objRecordSet.Close
objDBConnection.Close
Sub Errors()
Wscript.Echo strError
Wscript.Quit
End Sub
Msgbox "De naam van dit station is: " & strREG
'objShell.RegWrite "HKLM\Software\GWIS\QueryResult", strREG, "REG_SZ"
Wscript.Quit()
Another ADO problem with Windows PE 1.2. I'm using the script below to
update a record in an SQL database. Becouse Windows PE does'nt support ADO
in HTA files properly (so it seems), i had to use a regular vbs script. But
when i run this one it gives me an error that the class isn't registered, im
getting reeealy tired of running into this kind of errors, why say that
Windows PE supports ADO while it really doesn't do a good job!
Ok, i am still using Windows PE 1.2, with the new
'buildoptionalcomponents.vbs'. This is becouse Ms has not yet updated the
msvl website...
When i run the script it gives me code: 80040154 line: 34 char:1 error:
'Class not registered' source: provider
Thanks for your time and any help.
Koen.
This is the script: (don't mind the incorrect line brakes)
'Opiton Explicit
'On Error Resume Next
Dim Catalog, SQLQery1, PWD, USERNAME, SERVER, strREG
Dim objDBConnection, objRecordSet
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objShell = Wscript.CreateObject("Wscript.Shell")
'haal waarden op uit register
strBestand = objShell.RegRead("HKLM\Software\GWIS\Bestand")
strPartitie = objShell.RegRead("HKLM\Software\GWIS\Partitie")
strMacAdres = objShell.RegRead("HKLM\Software\GWIS\MacAdres")
strOmgeving = objShell.RegRead("HKLM\Software\GWIS\Omgeving")
strNaam = objShell.RegRead("HKLM\Software\GWIS\Name")
'Maak een connectie naar de database
set objDBConnection = Wscript.CreateObject("ADODB.Connection")
set objRecordSet = Wscript.CreateObject("ADODB.Recordset")
SERVER = "192.168.2.1"
USERNAME = "sa"
PWD = "password"
Catalog = "Images"
objDBConnection.ConnectionString = "Provider=SQLOLEDB;Data
Source="&SERVER&";Initial Catalog="&Catalog&";User
ID="&USERNAME&";Password="&PWD&";"
objDBConnection.Open
objRecordSet.CursorLocation = adUseClient
objRecordSet.ActiveConnection = objDBConnection
'This line below is line 34 in the script...
objRecordSet.Open "SELECT * From " & strOmgeving , objDBConnection,
adOpenStatic, adLockOptimistic
objRecordSet.MoveFirst
objRecordSet.Find = "Mac = '" & strMacAdres & "'"
If objRecordSet.EOF then
objRecordSet.MoveFirst
objRecordSet.Find = "Mac = 'leeg'"
If objRecordSet.EOF Then
strError = "Geen vrije station namen meer in de " & strOmgeving
& " omgeving."
Errors()
End If
objRecordSet("Mac") = strMacAdres
objRecordSet.Update
End If
strREG = objRecordSet("Naam")
objRecordSet.Close
objDBConnection.Close
Sub Errors()
Wscript.Echo strError
Wscript.Quit
End Sub
Msgbox "De naam van dit station is: " & strREG
'objShell.RegWrite "HKLM\Software\GWIS\QueryResult", strREG, "REG_SZ"
Wscript.Quit()