However I'm having an issue when attempting to read any values from the SQL database. I have tested with the same code in a VBS file and it executes fine under WinPE 2004.
Code is below:
<HTML>
<HEAD>
<TITLE>HTA - HTML Applications</TITLE>
<HTA:APPLICATION
WINDOWSTATE="maximize"
BORDER="none"
INNERBORDER="no"
SHOWINTASKBAR="no"
SCROLL="no"
APPLICATIONNAME="Build"
NAVIGABLE="yes">
</HEAD>
<script language="VBScript">
Sub TestADO
Set objADOConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objADOConnection.Open "Provider=SQLOLEDB;Data Source=MSSQL01;Initial Catalog=BuildDB;User ID=build;Password=build01;"
SQLQuery1 = "Select * From Server"
objRecordSet.Open SQLQuery1, objADOConnection, 2, 2
objRecordSet.MoveFirst
DataArea.InnerHTML = objRecordSet.Fields("ServerName")
End Sub
</script>
<BODY STYLE="font:14 pt arial; color:white; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#000000', EndColorStr='#0000FF')">
<DIV STYLE="position:relative;left:90;top:100;width:100%;">
<FONT COLOR="White" FACE="Tahoma">
<H2>Build Environment </H2>
<BR><BR>
<INPUT TYPE="button" VALUE="ADO Test" NAME="run_button" onClick="TestADO">
<P>
<BUTTON ACCESSKEY="x" STYLE="font-face:Tahoma;font-size:13px;" onClick="self.close()">E<U>x</U>it</BUTTON>
<SPAN ID = "DataArea"></SPAN>
</FONT>
</DIV>
</BODY>
</HTML>
When I click the ADO Test button nothing happens. As mentioned if i create a VBS file with the VBScript code for the sub TestADO it works fine (using wscript.echo).
It seems to fail on objADOConnection.Open line, found this out by commentting out each line in turn.
Any ideas?
This post has been edited by dlaw8073: 07 June 2006 - 02:47 AM



Help
Back to top









