MSFN Forum: HTA and SQL - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

HTA and SQL Rate Topic: -----

#1 User is offline   dlaw8073 

  • Group: Members
  • Posts: 1
  • Joined: 05-June 06

Posted 06 June 2006 - 05:11 AM

Hopefully someone can help, i'm trying to write a HTA application that reads information from an SQL database and then kicks of an unattended build.

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



#2 User is offline   ChrisBaksa 

  • Member
  • PipPip
  • Group: Members
  • Posts: 230
  • Joined: 05-March 04

Posted 19 June 2006 - 06:06 AM

Suggestion....

Scrap the HTA. Write yourself a small app (exe) that does it all.
The app that we wrote can read from teh DB and write to it as well.

Chris

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy