473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Retriving data Using 2 sql statements...



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></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>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
1 1206
Why are you doing this in two select statements?

<%
Test = request.querystring("Test")
Set Conn = CreateObject("ADODB.Connection")
Conn.Open "eiwp"
' stop using DSNs!
' please see http://www.aspfaq.com/2126

' "Select * from tblopgaCOm2 WHERE Test = " & Test
' do not use SELECT *!
' please see http://www.aspfaq.com/2096

SQLQuery = "SELECT priorcomments, area " & _
" FROM tblopgaCOm2 " & _
" WHERE Test = " & Test
' I assume Test is a numeric?

set rs = conn.execute(SQLQuery)
priorcomments = Server.HTMLEncode(rs(0))
area = Server.HTMLEncode(rs(1))
response.write "<textarea>" & priorcomments
response.write "</textarea><textarea>"
do while not rs.eof
response.write rs("area") & ", "
rs.movenext
loop
rs.close: set rs = nothing
conn.close: set conn = nothing
%>

You can put the rest of your HTML back in there. For other information, see
http://www.aspfaq.com/2188 (treatment of MEMO/TEXT columns, if that's what
priorcomments and/or area are).

--
http://www.aspfaq.com/
(Reverse address to reply.)


"iffy agbim" <ia******@hotmail.com> wrote in message
news:#B**************@tk2msftngp13.phx.gbl...


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></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>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: iffy agbim | last post by:
I have a form that displays information selected from an Access Data base. A select statement is used to do this on my asp page SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = '" &...
1
by: serge calderara | last post by:
Dear all, I am retriving the atribute of an assembly by using : obj = System.Reflection.Assembly.LoadFrom (sFile).GetCustomAttributes(True) Then fetching attribute object as folllow: ...
2
by: Niyazi | last post by:
Hi, I have to retrieve a data from AS400 DB2 and after working with data I have to export into one of existing Excel file. I can connect into specific library in AS400 DB2 using AS400...
2
by: Manish Naik | last post by:
Hi, Using ASP.Net, I want to store and retrive documents (Word, excel, etc) from SQL Server 2000 database. I have tried image type data field, but could not succed. Can any one help me please. ...
2
by: James Proctor | last post by:
Hi There, I have written an SQL script which i run though a VB.net application. It has some print statements in which print results of the Script to the message window if you run the script in...
2
by: balakrishnan.dinesh | last post by:
Hi frnds, Im having a problem with retriving "\" backslash , In my javascript client side page , ill get the response from the server side , the response will contain some url like...
1
by: Kunal Nandi | last post by:
can any one give me the code for uploading and retriving image using Blob, with jsp at front end and oracle8i at the back end ??????? i have tried this using long raw datatype i was able to upload...
6
by: kavithadevan | last post by:
Hi, I am trying to retriving some datas from the database.using submit button i am getting result but i inserted one submit image and i gave link to that image and then i run that script but its...
0
by: pchaitanya | last post by:
hi all, suppose in a table if i have columns namely name,entrydate now on retriving and binding to a gridview how can I get names rowwise and entrydate columnwise on a gridview on...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.