Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting ASP to an HTA

Status
Not open for further replies.

heprox

IS-IT--Management
Dec 16, 2002
178
US
I have two pages (both pages written in ASP/javascript). There is a search page (search.asp) and a results page (results.asp). These two pages are loaded in a frameset (frame.htm). Whenever I rename "frame.htm" to "frame.hta" everything fails to work correctly. Do ASP pages work inside of an HTA? I'm trying to build a fairly simple database application to retrieve a record based on the user's entered data.

frame.hta

<html>
<head>
<title>main</title>
<HTA:APPLICATION ID="simple app"
APPLICATIONNAME="simple app"
BORDER="thick"
BORDERSTYLE="normal"
CAPTION="yes"
CONTEXTMENU="no"
INNERBORDER="yes"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SCROLL="auto"
SCROLLFLAT="no"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="maximize"
</head>
<frameset rows="99,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="files/item_lookup_search.htm" application = "YES" name="topFrame" frameborder="no" scrolling="NO" noresize title="topFrame" >
<frame src="files/blank.htm" application = "YES" name="mainFrame" frameborder="no" title="mainFrame">
</frameset>
<noframes><body>
</body></noframes>
</html>

search.asp:
<html>
<head>
<title>Item Lookup Search</title>
</head>

<body>
<form action="/web/files/item_lookup_results.asp" method="get" name="item_lookup" target="bottomFrame" id="item_lookup"
onSubmit="return validateForm(this)">
<table border="0" cellspacing="2" class="sort-table">
<thead>
<tr>
<td colspan="2">Item Lookup:
</td>
</tr>
</thead>
<tbody>
<tr>
<th width="94" valign="top">Item Number:</th>
<td width="351" > <div align="left">
<input name="txtItemcode" type="text" id="txtItemcode" size="20" maxlength="9">
<span class="highLite">*</span><img src="/files/images/spacer.gif" alt="" width="20" height="18">
<input type="submit" name="Submit" value="Search">
<input name="Reset" type="reset" id="Reset" value="Reset" onclick="submit(this)"><br>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>

results.asp
<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="/Connections/GENRET.asp" -->
<%
var Recordset1__varItemCode = "";
if (String(Request.QueryString("txtItemCode")) != "undefined" &&
String(Request.QueryString("txtItemCode")) != "") {
Recordset1__varItemCode = String(Request.QueryString("txtItemCode"));
}
%>
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset");
Recordset1.ActiveConnection = MM_GENRET_STRING;
Recordset1.Source = "SELECT a.itm_cd, a.ve_cd, a.vsn, a.stat_cd, a.des1, a.udf1, c.udf012, d.des div, e.des dept, f.des class, a.first_rcv_dt, a.lst_buy_cst, a.ret_prc init_ret FROM gm_itm a, gm_itm_udf c, div d, dept e, class f, cst g WHERE a.itm_cd = c.itm_cd and a.itm_cd = g.itm_cd and a.div_cd = d.div_cd and a.dept_cd = e.dept_cd and a.class_cd = f.class_cd and a.itm_cd = '"+ Recordset1__varItemCode.replace(/'/g, "''") + "' group by a.itm_cd, a.ve_cd, a.vsn, a.stat_cd, a.des1, a.udf1, c.udf012, d.des, e.des, f.des, a.first_rcv_dt, a.lst_buy_cst, a.ret_prc";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 2;
Recordset1.LockType = 1;
Recordset1.Open();
var Recordset1_numRows = 0;
%>
<html>
<head>
<title>Item </title>

</head>

<body>
<table width="514" border="0">
<tr>
<td colspan="7">Item Information </td>
</tr>
<tr>
<td width="141">Item Code: </td>
<td width="228"><%=(Recordset1.Fields.Item("ITM_CD").Value)%></td>
<td width="19">&nbsp;</td>
<td width="21">&nbsp;</td>
<td width="21">&nbsp;</td>
<td width="21">&nbsp;</td>
<td width="33">&nbsp;</td>
</tr>
<tr>
<td>VSN:</td>
<td><%=(Recordset1.Fields.Item("VSN").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Vendor:<br>
</td>
<td><%=(Recordset1.Fields.Item("VE_CD").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Brand Code: </td>
<td><%=(Recordset1.Fields.Item("UDF1").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Brand Name: </td>
<td><%=(Recordset1.Fields.Item("UDF012").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Division:</td>
<td><%=(Recordset1.Fields.Item("DIV").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Department:</td>
<td><%=(Recordset1.Fields.Item("DEPT").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Class:</td>
<td><%=(Recordset1.Fields.Item("CLASS").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Description:</td>
<td><%=(Recordset1.Fields.Item("DES1").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>First Receipt Date: </td>
<td><%=(Recordset1.Fields.Item("FIRST_RCV_DT").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Initial Buy Cost:</td>
<td><%=(Recordset1.Fields.Item("LST_BUY_CST").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Initial Retail </td>
<td><%=(Recordset1.Fields.Item("INIT_RET").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Status:</td>
<td><%=(Recordset1.Fields.Item("STAT_CD").Value)%></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close();
%>


...whenever the search page is submitted the ASP attempts to load but then fails. It will not load into the bottom frame. Lastly, is there something special about the way you should reference the supporting files (images, etc.) none of these work corretly either. All I want to do is make a simple application that can be distributed to a persons desktop, without me having to go and create a full blown website.
 

When you say "everything fails to work correctly", what exactly happens? What doesn't happen that should? What errors do you get?

Dan


The answers you get are only as good as the information you give!

 
I can get the frameset to load with a blank page at the top and bottom as an HTA, however when I replace the blank pages with ASP pages I start getting the "Do you want to save this or open this" message bow. When I choose to open it I end up with the HTA application doing nothing and the ASP page kicks out to my HTML editor.

Chris: What is the best method for building a set of pages that can access a DSN datasource and return records inside of an HTA? I can't just rename my ASP pages to HTM they cease to work correctly then. Is it possible to build all HTM pages that access a DSN and return records? I've always used ASP pages to build databaser applications.
 
ASP has to run on a enabled server otherwise you get the open/download message.

The simplest way would be to use an Iframe with the src property set to a remote asp page

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
Nightclub counting systems

So long, and thanks for all the fish.
 
I thought of that as well, unfortunately the reason we were looking at doing this via an HTA was to not have to setup another web site on our internal intranet. So there is no way to have an HTA use an external DSN?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top