WinPE + HTA + SQL = Error

G

Guest

I'm writing an HTA file to automate some tasks in unattended installation.
This .HTA retrieves its data from an SQL database (it was an mdb file, but
WinPE didn't support mdb so now I copied the database to an SQL server)
I installed the optionalcomponents (HTA, WSH and ADO) and I'm able to
connect to the northwind database through a vbs file in WinPE. In the .hta
however it doesn't work (Same code). I'm using WinPE 2005.
On my XP desktop it works like a charm.

Here are the relevant pieces of code:

' Set server, database and username
strServer = "***"
strDatabase = "SWInstall"
strUserName = "sa"
strPassword = "***"

'Create and open the database object
Set objConnection = CreateObject("ADODB.Connection")
objConnection.open "Provider=SQLOLEDB;Data Source=" & strServer & ";Initial
Catalog=" & strDatabase & ";User ID=" & strUserName & ";Password=" &
strPassword & ";"

Dim SetNameValue
Dim DepNameValue
Dim SetVersionValue
Dim AM_DepNameValue
Dim AM_SetNameValue
Dim AM_SetVersionValue

Sub GetDep()
DepName.InnerHTML = ""

Set objRecordSet = CreateObject("ADODB.Recordset")
objRecordset.Open "SELECT DISTINCT DepName FROM SWSets", objconnection
objRecordSet.MoveFirst

strHTML = "<select onChange=""GetName()"" name=DepNameList>"
strHTML = strHTML & "<option value= " & chr(34) & Chr(34) & ">"
Do Until objRecordSet.EOF
strHTML = strHTML & "<option value= " & chr(34) &_
objRecordSet.Fields("DepName") & chr(34) &_
">" & objRecordSet.Fields("DepName")
objRecordSet.MoveNext
Loop

strHTML = strHTML & "</select>"
DepName.InnerHTML = strHTML
objRecordSet.Close
End Sub

<snip>

HTML part of the HTA:

<td>Step 1. Choose a PMG:</td>
<td><span id="DepName"><select size="1"></select></span></td>

As you can see I've got a "dummy" select box that is overwritten by the span
onload of the .HTA
On my desktop the select box is filled as it should, but on WinPE it is
erased (an empty depname.innerhtml is written to the span).

What do I need to do to get SQL support working within an HTA file on
WinPE????

Cheers, Michiel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top