Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Retriving Data frm DB via 2 sql statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Retriving Data frm DB via 2 sql statement

 Post Reply Post Reply
Author
ifeyinwa View Drop Down
Newbie
Newbie
Avatar

Joined: 17 March 2003
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote ifeyinwa Quote  Post ReplyReply Direct Link To This Post Topic: Retriving Data frm DB via 2 sql statement
    Posted: 01 June 2004 at 4:16pm

Hope you all are  alive and well cause I will need you to come to my rescue once again.
appreciate this as Always.
I am  working with asp with an Access DB back end.

The code below worked well until I added this second select statement;
{SELECT area FROM tblopgaCOm2 WHERE billNo = '" &
 Request.Form("BILLNO") " }
this select statement should display its data in the text area called
otherdescription.But no data is being displayed.
All the other data that is displayed on the form are displayed from the 1st SQL
Statement which works okay.
 
Is it possible to look at my script & tell me if I am missing out anything from this script.A precise response will be greatly appreciated.Thank you.

<%
Test = request.querystring("Test")    
StrbillNo = Trim(Request.form("billNo"))
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("adodb.Recordset")
Set Rs1 = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp"
SQLQuery = "Select * from tblopgaCOm2 WHERE Test = " & Test
RS.Open SQLQuery ,Conn,1,1

SQLQuery1= "SELECT area FROM tblopgaCOm2 WHERE billNo =

'"&Request.Form("billNO")&"' " 
Rs1.Open SQLQuery1, Conn,1,1
%>

<form method="POST" action="legconfirm.asp" >         
     <td width="20%" bgcolor="#99CCFF" height="36">&nbsp;<b><font        

size="2">ID#:
        </font> </b><input type="text" name="Test" style="background-color:

#D2D2D2"  size="9" value="<%=RS("Test")%>" readonly></td>
      <td width="43%" bgcolor="#99CCFF" height="36">&nbsp;<b><font

size="2">BILL</font>#</b>
        <input type="text" name="billNo" style="background-color: #D2D2D2" 

size="9" value="<%=RS("billNo")%>" readonly></td>
      <td width="10%" bgcolor="#99CCFF" height="36">&nbsp;&nbsp;&nbsp;

<input type="text" name="rdr3rd" style="background-color: #D2D2D2" 

size="13" value="<% if RS("rdr3rd")= "Y"  Then
  Response.write("3rd Reader")
Else
 Response.write("")

End if%>"  readonly  </td>
      <td width="23%" bgcolor="#99CCFF" height="36"><font

size="2"><b>PRIORCOMMENTS:</b></font>&l t;/td>
      <td width="239%" bgcolor="#C0C0C0" height="36" colspan="4"><textarea

rows="8" name="priorcomments" readonly style="background-color:

#D2D2D2" cols="50"><%=RS("priorcomments")%></textarea>
        <p>&nbsp;</td>
      <td width="23%" bgcolor="#99CCFF" height="36"><font

size="2"><b>OTHER
        DESCRIPTION</b></font><b><font size="2">:</font></b></td>
      <td width="239%" bgcolor="#E6E3E4" height="36" colspan="4">
     
      <%While Not Rs1.EOF%>
        <%
        Dim desc
        desc=desc & Rs1("area")&","
        %>
       <%
          Rs1.MoveNext
        Wend
      %>

    <textarea rows="2" name="otherdescription" cols="20"> 
       
    <%=desc%></textarea></td>
       <tr>
      <td width="23%" bgcolor="#99CCFF" height="36"><b><font

size="2">COMMENTS:</font></b></td>
      <td width="239%" bgcolor="#E6E3E4" height="36" colspan="4"><textarea

rows="6" name="comments" cols ="50"><%=RS("comments")%></textarea>
      <td width="52%" height="36">&nbsp;</td>
         <tr>
      <td width="23%" bgcolor="#99CCFF" height="36"><input type="submit"

value="Submit" name="B1"><input type="reset" value="Reset"

name="B2"></td>
    

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2004 at 12:46pm
are you sure there are anything in the field?
Back to Top
ifeyinwa View Drop Down
Newbie
Newbie
Avatar

Joined: 17 March 2003
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote ifeyinwa Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2004 at 2:41pm

yes there are values in the  field.

I am getting just one value returned  in the textarea called otherdescription  based on the 2nd sql statement in my code .


The values returned from the field in the DB called area should be 2 values and not one value  .can anyone tell me what I am missing out .
Is it that it is not looping well or what????.The first sql  displays all the infor required into the form based on the billNo selected. that works okay

<%
 Test = request.querystring("Test")
 Set Conn = Server.CreateObject("ADODB.Connection")
 Set Rs = Server.CreateObject("adodb.Recordset")
 Set Rs1 = Server.CreateObject("adodb.Recordset")
 Conn.Open "eiwp"
 SQLQuery = "Select * from tblopgaCOm2 WHERE Test = " & Test
 RS.Open SQLQuery ,Conn,1,1
 
 strBillNo=RS("billNo")
 
 SQLQuery1= "Select area FROM tblopgaCOm2 WHERE billNo = " & strBillNo &"' "
 RS1.Open SQLQuery ,Conn,1,1
 
%>
<form method="POST" action="legconfirm.asp" >         
<td width="23%" bgcolor="#99CCFF" height="36"><font size="2"><b>PRIORCOMMENTS:</b></font>&l t;/td>
      <td width="239%" bgcolor="#C0C0C0" height="36" colspan="4"><textarea rows="8" name="priorcomments" readonly style="background-color: #D2D2D2" cols="50"><%=RS("priorcomments")%></textarea>
        <p>&nbsp;</td>
      <td width="52%" height="36">&nbsp;</td>
         <tr>
      <td width="23%" bgcolor="#99CCFF" height="36"><font size="2"><b>OTHER
        DESCRIPTION</b></font><b><font size="2">:</font></b></td>
      <td width="239%" bgcolor="#E6E3E4" height="36" colspan="4">
      <textarea rows="4" name="otherdescription" cols="20">
       <%While Not Rs1.EOF
 Response.Write(Rs1("area") & ", ")
         Rs1.MoveNext
        Wend 
        %>
</textarea></td>

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.