I am attempting to retrieve a value from a database and populate a
textbox on my html form. This code appears to run fine without error
but i do not get any value in my textbox. Im very new to ASP and im
having to change an existing system. If i do not put my vbscript code
at the bottom of the screen then my page will not render correctly.
Can anyone please help me ??? Are there any major flaws with my code
??? should my script be before my textbox ???? by the way im only
hardcoding input values for test purposes.
<%@ Language=vbscript LCID=2057%>
<HTML>
<HEAD>
<title>IDD Document</title>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0"
MS_POSITIONING="GridLayout" bgcolor="#ffdcff">
<form id="Form1" method="post" runat="server">
<TABLE id="Table1" style="Z-INDEX: 102; LEFT: 0px; POSITION: absolute;
TOP: 0px" cellSpacing="0"cellPadding="0" width="100%" border="0"
height="100%">
<TBODY>
<TR>
<TD style="HEIGHT: 42px" vAlign="top">
<BR>
<INPUT id="btn_BackToMenu" type="button" value="Close Window"
onclick="window.close()" runat="server"></TD>
*******************************************************************
*******************TEXT BOX I WANT TO POPULATE*********************
<input type="text" name="T1" size="20" value="<%= strtext%>"
*******************************************************************
*******************************************************************
</TR>
<TR>
<TD><iframe name="myIframe" height="100%" width="100%"
frameborder=no src="documents/IDD.pdf" </TR>
</td></form>
</TABLE>
</form>
</body></IFRAME></TR></TBODY></TABLE></FORM>
*****************************************************************************
******************VBSCRIPT CODE********************************
*****************************************************************************
<%
Dim oRS, strSQL, txt_ClientCode, strtext
txt_ClientCode = "AA3"
If len(txt_ClientCode)>0 Then
'strSQL = "Select ClientCode, PDFName From tbl_PaymentProtectionPDF
Where ClientCode='" & txt_ClientCode & "'"
strSQL = "Select ClientCode, PDFName From tbl_PaymentProtectionPDF
Where ClientCode = '" & txt_ClientCode & "'"
Set oRS = Server.CreateObject("ADODB.RecordSet")
oRS.Open strSQL,Application("ConnectionString"),adOpenKeyset,adLockOptimistic
If Not (oRS.EOF And oRS.BOF) Then
strtext = oRS("ClientCode")
Response.Write(strtext)
oRS.Delete
oRS.Update
End IF
oRS.Close
Set oRS = Nothing
Response.End
End If
%>
*****************************************************************************
******************VBSCRIPT CODE********************************
*****************************************************************************
</BODY>
</HTML>