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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error message

Status
Not open for further replies.

ifeyinwa

Programmer
Mar 26, 2003
112
US
I have a database in Access. Scripting in asp.
BACKGROUND
Each user can only view infor for a billNo from their designated “area”. Eg Joe from the audit dept can view billNO HB0030 from the audit dept. However the same billNo HB0030 also appears in another dept say Fin. So users in the fin dept can also see the same billNo.
Therefore I have a login page (login.asp)where user is authenticated , dept determined and user sent to their dept page. This dept page(dept.asp) is a list of billNo assigned to that dept and a few details /infor for that bill no. each billNO on this dept page is a hyperlink, which takes you to another page (submitpage.asp) with more detailed information about the bill where also infor can be entered and submitted by user
The page where I have this error message is the (submitpage.asp) which
like I had said is a display of information regarding a bill selected from the previous page(dept.asp).hence the FIRSTSql query
It also displays the other "area" where that same bill no appears as in the 2NDsqlquery .
However I get an error on line 7- RS.Open SQLQuery ,Conn,1,1
why??

<%
billNO = request.querystring("billNo")

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp"
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = "& billNo
RS.Open SQLQuery ,Conn,1,1

strBillNo=RS("billNo")

SQLQuery1= "Select area FROM tblopgaCOm2 WHERE billNo = '"&strBillNo&"'"
Set RS1=Conn.Execute(SQLQuery1)
%>





<form method="POST" action="legconfirm.asp" >
<td width="155%" bgcolor="#C0C0C0" height="36" colspan="5"><b><font size="2">
BILL</font>#</b> <b><font color="#000080">
<input type="text" name="billNo" style="background-color: #D2D2D2; font-weight: bold; color: #000080" size="9" value="<%=RS("billNo")%>" readonly></font></b>&nbsp;<font size="2"><b> <b><font color="#000080">
<b>AREA<input type="text" name="area" style="background-color: #D2D2D2; color: #000080; font-weight: bold; text-align: Left" size="8" value="<%=RS("area")%>" readonly>
<b>OTHER AREARS FOR COMMENTS</b></font><b><font size="2">:</font></b></td>
<td width="159%" bgcolor="#E6E3E4" height="36" colspan="4">
<textarea rows="2" name="otherdescription" readonly style="background-color: #D2D2D2" cols="27">

<% Do Until RS1.EOF
Response.write RS1("area")&","
RS1.MoveNext
Loop
RS1.Close
%>

</textarea>
</td>
</tr>
<tr>
<td width="23%" bgcolor="#C0C0C0" height="36"><b><font size="2">COMMENTS:</font></b></td>
<td width="159%" bgcolor="#E6E3E4" height="36" colspan="4"><textarea rows="3" name="comments" cols ="50"><%=RS("comments")%></textarea>
<td width="142%" height="36">&nbsp;</td>
<tr>

 
it look slike billNo is a string. In which case it needs to be within quotes:
Code:
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = '" & billNo & "'"

Tony
_______________________________________________________________
 
Another quick question
In my page dept.asp where infor on a bill is displayed in 3 columnar headings How do I make each of those column heading to be a hyperlink and when clicked on resort the table/column in ascending order.
This is the script for the page so far.How do I add this functionality on to this page.

</div>
<div align="left">
<table>
<td>
<table border="0" cellpadding="2" cellspacing="4" width="1090" height="59">
<tr>
<td width="38" bgcolor="#EDEEF1" height="20"><font color="#00000B" size="3"><i><b>&nbsp;&nbsp;&nbsp;
ID</b></i></font></td>
<td width="90" bgcolor="#EDEEF1" height="20">
<p align="center"><font color="#00000B" size="3"><i><b>Bill#</b></i></font></p>
</td>
<td width="321" bgcolor="#EDEEF1" height="20">
<p align="center"><font color="#00000B" size="3"><i><b>Description</b></i></font></p>
</td>
</tr>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS=Server.CreateObject("ADODB.RecordSet")
Conn.Open "eiwp"
SQLquery = "Select * from tblopgaCom2 where area LIKE 'AUDIT' order by billNo asc"
RS.Open SQLquery, Conn
If RS.EOF then
Response.write "<center>There are no records in the table"
Respose.write "<br>please check back later</center>"
Response.end
Else
DO WHILE NOT RS.EOF
%>

<tr>
<td width="38" style="font-weight: bold; border-left-style: solid; border-bottom-style: solid" height="19"><b><a href ="audit166.asp?billNo=<%=RS("billNo")%>">
<p align="center"><font color="#FF0000" size="2" face="Arial">
<i><%=RS("billNo")%></i></font></b></td>
<td width="90" style="font-weight: bold; border-left-style: solid; border-bottom-style: solid" height="19"><b>
<p align="center"><font size="2" color="#003399" face="Arial">
<i></i></font></a></b></td>
<td width="321" style="font-weight: bold; border-left-style: solid; border-bottom-style: solid" height="19"><b>
<p align="center"><font color="#003399" size="2" face="Arial">
<i><%=RS("Description")%></i></font></b></td>
</tr>
<%
Rs.MoveNext
Loop
End If
Rs.close
Set RS = Nothing

Conn.Close
Set Conn = Nothing

%>
</table>


 
try something like this

Code:
</div>
<div align="left">
     <table>
      <td>
    <table border="0" cellpadding="2" cellspacing="4" width="1090" height="59">
       <tr>
       <td width="38" bgcolor="#EDEEF1" height="20"><font color="#00000B" size="3"><i><b>&nbsp;&nbsp;&nbsp;
        <a href="thispagename.asp?sort=1">ID</a></b></i></font></td>
       <td width="90" bgcolor="#EDEEF1" height="20">
        <p align="center"><font color="#00000B" size="3"><i><b><a href="thispagename.asp?sort=2">Bill#</a></b></i></font></p>
       </td>
       <td width="321" bgcolor="#EDEEF1" height="20">
        <p align="center"><font color="#00000B" size="3"><i><b><a href="thispagename.asp?sort=2">Description</a></b></i></font></p>
       </td>  
    </tr>
 <%
 Set Conn = Server.CreateObject("ADODB.Connection")
 Set RS=Server.CreateObject("ADODB.RecordSet")
 Conn.Open "eiwp"
 
 select case request("sort")
 case "1"
 SQLquery = "Select * from tblopgaCom2 where area LIKE 'AUDIT' order by id asc"
 case "3"
 SQLquery = "Select * from tblopgaCom2 where area LIKE 'AUDIT' order by description asc"
 case else
 SQLquery = "Select * from tblopgaCom2 where area LIKE 'AUDIT' order by billNo asc" 
 end select
 
  RS.Open SQLquery, Conn
 If RS.EOF then
     Response.write "<center>There are no records in the table"
     Respose.write "<br>please check back later</center>"
     Response.end
 Else
 DO WHILE  NOT RS.EOF  
%>
   
<tr>
      <td width="38" style="font-weight: bold; border-left-style: solid; border-bottom-style: solid" height="19"><b><a href ="audit166.asp?billNo=<%=RS("billNo")%>">
        <p align="center"><font color="#FF0000" size="2" face="Arial">
        <i><%=RS("billNo")%></i></font></b></td>
      <td width="90" style="font-weight: bold; border-left-style: solid; border-bottom-style: solid" height="19"><b>
        <p align="center"><font size="2" color="#003399" face="Arial">
        <i></i></font></a></b></td>
      <td width="321" style="font-weight: bold; border-left-style: solid; border-bottom-style: solid" height="19"><b>
        <p align="center"><font color="#003399" size="2" face="Arial">
        <i><%=RS("Description")%></i></font></b></td>
      </tr>
 <%
 Rs.MoveNext
    Loop
  End If
 Rs.close
 Set RS = Nothing
 
 Conn.Close
 Set Conn = Nothing
  
%>
</table>

i did it quick so please check, also update your url name
 
Thank you so much your code did work. Most appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top