Hello, Can anyone help me with this?
I need to know what I am doing wrong with my code. I have an input form and the form is pulling from two tables, a wo_table and a project_table. I am calling a work order number from a report list and the input form appears. Now the problem, the form opens and displays the data from the wo_table (this is good), but it only displays the “Builder Information” title and no input fields. I know this is because there are no records matching the work order number I pulled from the wo_table. I am sure there is a way to output empty records.
I am in desperate need of help and appreciate your support. My code is listed below.
<%@ LANGUAGE="vbscript" %>
<% set Dataconn = server.CreateObject("ADODB.Connection"
Dataconn.Open "Data Source=wa-prodserv;Provider=SQLOLEDB; Initial Catalog=wotable;User ID=wouse;Password=special6"
session("wo_number" = Request.QueryString("RecordID"
msql = "SELECT * FROM wo_table where wo_number=" & Request.QueryString("RecordID"
Set RS = DataConn.Execute(msql)
%>
<html>
<head>
<title> Work Order Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Pragma" content="no-cache">
<LINK href/project/css/project.css" rel=stylesheet type="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="/project/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">document.write(CalendarPopup_getStyles());</SCRIPT>
<SCRIPT language="JavaScript1.2" src="/project/validation.js"></SCRIPT>
</HEAD>
<BODY aLink=#003366 bgColor=#ffffff
leftMargin=4 valign="center" link=#003366 topMargin=3 vLink=#003366 marginheight="0" marginwidth="0">
<form method="post" action="post_db.asp" name="WOForm" id="WOForm">
<input type="hidden" name="status" value="Build Completed" size="20">
<input type="hidden" name="builder_name" value="<%=RS("builder_name"%>">
<input type="hidden" name="wo_number" value="<%=RS("wo_number"%>">
<div align="center">
<center>
<table cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#6699CC" border="2" width="98%">
<tr>
<td valign="top" bgcolor="#E5E5E5">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#6699CC" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td style="border-style: none; border-width: medium" bgcolor="#3F7DBC" colspan="2" height="20">
Work Request Form: Development</td>
<td style="border-style: none; border-width: medium" bgcolor="#3F7DBC" height="20" align="right"> Request Date: <%=RS("submit_date"%> </td>
</tr>
<tr>
<td style="border-style: none; border-width: medium" align="center">
Work Order Number: <%=RS("wo_number"%> </td>
<td style="border-style: none; border-width: medium" align="center">
Status: <%=RS("status"%> </td>
<td style="border-style: none; border-width: medium" align="center">
Priority: <%=RS("priority"%>
</STRONG></td>
</tr>
</table></td>
</tr>
<tr>
<td style="border-style: none; border-width: medium" valign="top" >
<table border="1" cellpadding="0" cellspacing="0" bordercolor="##003366" style="border-width:0; border-collapse: collapse" width="100%">
<tr>
<td align="center" style="border-style:none; border-width:medium; " bgcolor="#E5E5E5" valign="top>
<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td colspan="2" height="1" > </td>
</tr>
<tr>
<td colspan="2" ></td>
</tr>
<tr>
<td colspan="2"><li class="bullettext"><strong> REQUESTER INFORMATION</strong></td>
</tr>
<tr>
<td width="20"> </td>
<td >
<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" >
<tr>
<td width="300" >Name: <%=RS("requester_name"%></td>
<td >Buidl Date: <%=RS("components"%></td>
</tr>
<tr>
<td width="300" >Phone Number: <%=RS("requester_phone"%></td>
<td >Build Type: <%=RS("request_type"%></td>
</tr>
<tr>
<td width="300" >Department: <%=RS("requester_department"%></td>
<td >Completion Date: <%=RS("required_completion_date"%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="20"> </td>
<td ><br>
Build Description:<br>
<%=RS("project_description"%></td>
</tr>
<tr>
<tr>
\<td colspan="2">
<hr color="#6699CC" size="1"></td>
</tr>
<tr>
<!-- RELEASE -->
<tr>
<td colspan="2"><li class="bullettext"><strong> RELEASE INFORMATION </font> </strong></td>
</tr>
<%
mysql = "SELECT * FROM wo_table where wo_number=" & Request.QueryString("RecordID"
Set RS = DataConn.Execute(mysql)
IF not RS.EOF then
%>
<tr>
<td width="20"> </td>
<td >
<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" >
<tr>
<td width="249" >Project Date: <%=RS("project_date"%></td>
<td width="330" >Project Lead: <%=RS("project_lead"%></td>
<td >Site: <%=RS("site"%></td>
<td width="160" >Build Date: <%=RS("build_date"%></td>
</tr>
</table>
</td>
</tr>
<tr>
<%End IF%>
<!-- BUILDER INPUT SECTION -->
<tr>
<td colspan="2">
<hr color="#6699CC" size="1"></td>
</tr>
<tr>
<td colspan="2" > <li class="bullettext"><STRONG> BUILDER INFORMATION</STRONG></td>
</tr>
<%
mysql = "SELECT * FROM project_table where wo_number=" & Request.QueryString("RecordID"
Set DS = DataConn.Execute(mysql)
IF not DS.EOF then
mySQL = "Insert into project_table (wo_number,builder_name,build_start_date,build_completion_date,build_comments) Values('"&wo_number&"','"&builder_name&"','"&build_start_date&"','"&build_completion_date&"','"&build_comments&"');"
%>
<td rowspan="2" > </td>
<td >Builder Name: <%=DS("builder_name"%> Start
Date:
<SCRIPT LANGUAGE="JavaScript">
var cal1x = new CalendarPopup("caldiv1"
</SCRIPT>
<INPUT TYPE="text" NAME="build_start_date" VALUE="<%=DS("build_start_date"%>" SIZE=10 tabindex="1">
<A HREF="#" onClick="cal1x.select(document.forms[0].build_start_date,'anchor1x','MM/dd/yyyy'); return false;"
NAME="anchor1x" ID="anchor1x"><img border="0" src="/tsd/images/icons/icon_cordinate.gif" title="Select Date"></A>
Completed Date:
<SCRIPT LANGUAGE="JavaScript">
var cal2x = new CalendarPopup("caldiv1"
</SCRIPT>
<INPUT TYPE="text" NAME="build_completion_date" VALUE="<%=DS("build_completion_date"%>" SIZE=10 tabindex="2">
<A HREF="#" onClick="cal2x.select(document.forms[0].build_completion_date,'anchor2x','MM/dd/yyyy'); return false;"
NAME="anchor2x" ID="anchor2x"><img border="0" src="/tsd/images/icons/icon_cordinate.gif"title="Select Date"></A></td>
<tr>
<td valign="top" ><br>Builder Comments:<br>
<textarea rows="3" name="build_comments" cols="100" tabindex="3"><%=DS("build_comments"%></textarea></td>
</tr>
<tr>
<td ></td>
<td ></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<%End If %>
<!--SUBMIT BUTTON -->
<td colspan="7" align="center" >
<input name="submit" type="submit" value="Submit">
</td>
</tr>
</table>
</form>
<ID="caldiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;">
</center>
</div>
</BODY>
</HTML>
I need to know what I am doing wrong with my code. I have an input form and the form is pulling from two tables, a wo_table and a project_table. I am calling a work order number from a report list and the input form appears. Now the problem, the form opens and displays the data from the wo_table (this is good), but it only displays the “Builder Information” title and no input fields. I know this is because there are no records matching the work order number I pulled from the wo_table. I am sure there is a way to output empty records.
I am in desperate need of help and appreciate your support. My code is listed below.
<%@ LANGUAGE="vbscript" %>
<% set Dataconn = server.CreateObject("ADODB.Connection"
Dataconn.Open "Data Source=wa-prodserv;Provider=SQLOLEDB; Initial Catalog=wotable;User ID=wouse;Password=special6"
session("wo_number" = Request.QueryString("RecordID"
msql = "SELECT * FROM wo_table where wo_number=" & Request.QueryString("RecordID"
Set RS = DataConn.Execute(msql)
%>
<html>
<head>
<title> Work Order Request</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Pragma" content="no-cache">
<LINK href/project/css/project.css" rel=stylesheet type="text/css">
<SCRIPT LANGUAGE="JavaScript" SRC="/project/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">document.write(CalendarPopup_getStyles());</SCRIPT>
<SCRIPT language="JavaScript1.2" src="/project/validation.js"></SCRIPT>
</HEAD>
<BODY aLink=#003366 bgColor=#ffffff
leftMargin=4 valign="center" link=#003366 topMargin=3 vLink=#003366 marginheight="0" marginwidth="0">
<form method="post" action="post_db.asp" name="WOForm" id="WOForm">
<input type="hidden" name="status" value="Build Completed" size="20">
<input type="hidden" name="builder_name" value="<%=RS("builder_name"%>">
<input type="hidden" name="wo_number" value="<%=RS("wo_number"%>">
<div align="center">
<center>
<table cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#6699CC" border="2" width="98%">
<tr>
<td valign="top" bgcolor="#E5E5E5">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#6699CC" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td style="border-style: none; border-width: medium" bgcolor="#3F7DBC" colspan="2" height="20">
Work Request Form: Development</td>
<td style="border-style: none; border-width: medium" bgcolor="#3F7DBC" height="20" align="right"> Request Date: <%=RS("submit_date"%> </td>
</tr>
<tr>
<td style="border-style: none; border-width: medium" align="center">
Work Order Number: <%=RS("wo_number"%> </td>
<td style="border-style: none; border-width: medium" align="center">
Status: <%=RS("status"%> </td>
<td style="border-style: none; border-width: medium" align="center">
Priority: <%=RS("priority"%>
</STRONG></td>
</tr>
</table></td>
</tr>
<tr>
<td style="border-style: none; border-width: medium" valign="top" >
<table border="1" cellpadding="0" cellspacing="0" bordercolor="##003366" style="border-width:0; border-collapse: collapse" width="100%">
<tr>
<td align="center" style="border-style:none; border-width:medium; " bgcolor="#E5E5E5" valign="top>
<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td colspan="2" height="1" > </td>
</tr>
<tr>
<td colspan="2" ></td>
</tr>
<tr>
<td colspan="2"><li class="bullettext"><strong> REQUESTER INFORMATION</strong></td>
</tr>
<tr>
<td width="20"> </td>
<td >
<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" >
<tr>
<td width="300" >Name: <%=RS("requester_name"%></td>
<td >Buidl Date: <%=RS("components"%></td>
</tr>
<tr>
<td width="300" >Phone Number: <%=RS("requester_phone"%></td>
<td >Build Type: <%=RS("request_type"%></td>
</tr>
<tr>
<td width="300" >Department: <%=RS("requester_department"%></td>
<td >Completion Date: <%=RS("required_completion_date"%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="20"> </td>
<td ><br>
Build Description:<br>
<%=RS("project_description"%></td>
</tr>
<tr>
<tr>
\<td colspan="2">
<hr color="#6699CC" size="1"></td>
</tr>
<tr>
<!-- RELEASE -->
<tr>
<td colspan="2"><li class="bullettext"><strong> RELEASE INFORMATION </font> </strong></td>
</tr>
<%
mysql = "SELECT * FROM wo_table where wo_number=" & Request.QueryString("RecordID"
Set RS = DataConn.Execute(mysql)
IF not RS.EOF then
%>
<tr>
<td width="20"> </td>
<td >
<table border="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" >
<tr>
<td width="249" >Project Date: <%=RS("project_date"%></td>
<td width="330" >Project Lead: <%=RS("project_lead"%></td>
<td >Site: <%=RS("site"%></td>
<td width="160" >Build Date: <%=RS("build_date"%></td>
</tr>
</table>
</td>
</tr>
<tr>
<%End IF%>
<!-- BUILDER INPUT SECTION -->
<tr>
<td colspan="2">
<hr color="#6699CC" size="1"></td>
</tr>
<tr>
<td colspan="2" > <li class="bullettext"><STRONG> BUILDER INFORMATION</STRONG></td>
</tr>
<%
mysql = "SELECT * FROM project_table where wo_number=" & Request.QueryString("RecordID"
Set DS = DataConn.Execute(mysql)
IF not DS.EOF then
mySQL = "Insert into project_table (wo_number,builder_name,build_start_date,build_completion_date,build_comments) Values('"&wo_number&"','"&builder_name&"','"&build_start_date&"','"&build_completion_date&"','"&build_comments&"');"
%>
<td rowspan="2" > </td>
<td >Builder Name: <%=DS("builder_name"%> Start
Date:
<SCRIPT LANGUAGE="JavaScript">
var cal1x = new CalendarPopup("caldiv1"
</SCRIPT>
<INPUT TYPE="text" NAME="build_start_date" VALUE="<%=DS("build_start_date"%>" SIZE=10 tabindex="1">
<A HREF="#" onClick="cal1x.select(document.forms[0].build_start_date,'anchor1x','MM/dd/yyyy'); return false;"
NAME="anchor1x" ID="anchor1x"><img border="0" src="/tsd/images/icons/icon_cordinate.gif" title="Select Date"></A>
Completed Date:
<SCRIPT LANGUAGE="JavaScript">
var cal2x = new CalendarPopup("caldiv1"
</SCRIPT>
<INPUT TYPE="text" NAME="build_completion_date" VALUE="<%=DS("build_completion_date"%>" SIZE=10 tabindex="2">
<A HREF="#" onClick="cal2x.select(document.forms[0].build_completion_date,'anchor2x','MM/dd/yyyy'); return false;"
NAME="anchor2x" ID="anchor2x"><img border="0" src="/tsd/images/icons/icon_cordinate.gif"title="Select Date"></A></td>
<tr>
<td valign="top" ><br>Builder Comments:<br>
<textarea rows="3" name="build_comments" cols="100" tabindex="3"><%=DS("build_comments"%></textarea></td>
</tr>
<tr>
<td ></td>
<td ></td>
</tr>
<tr>
<td colspan="2" align="center"> </td>
</tr>
<%End If %>
<!--SUBMIT BUTTON -->
<td colspan="7" align="center" >
<input name="submit" type="submit" value="Submit">
</td>
</tr>
</table>
</form>
<ID="caldiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;">
</center>
</div>
</BODY>
</HTML>