Computing.Net > Forums > Programming > asp page prints html bfore recrdset

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

asp page prints html bfore recrdset

Reply to Message Icon

Name: nascent (by mboto)
Date: June 23, 2004 at 04:13:02 Pacific
OS: Win Xp Prof
CPU/Ram: 1.8/512
Comment:

Hi there,

I have an asp page that creates a record set from a database query. the problem i have is that no matter where i print the asp databse data from the recordset any html after it is always displayed to the screen first. So for example when I'm populating a form with data that a user will select and then "Submit" the submit/reset buttons are at the top of the page before all the data, regardless of the fact that i put the html for the buttons after the recordset data. Any ideas?

Thanks,
Mboto



Sponsored Link
Ads by Google

Response Number 1
Name: gpp
Date: June 23, 2004 at 05:39:37 Pacific
Reply:

Can you post any code?


0

Response Number 2
Name: nascent (by mboto)
Date: June 23, 2004 at 06:06:03 Pacific
Reply:

Yeah sure, The printQuestions function is called in a standard dreamwearver prodcued html page. The databaseinclude just contains the functions for opening the database shown below

Databaseinclude.asp
<%
Dim strDB
Dim con ' Our Connection Object
Dim rs ' Our Recordset Object

' Path to Database
strDB = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/dbasepath/yourdb.mdb")


Function OpenDatabase(intLockType) 'Open connection to the database and pass what type of locktype you require

Set con = CreateObject("ADODB.Connection")
con.Open strDB
Set rs = CreateObject("ADODB.Recordset")
rs.LockType = intLockType

End Function

Sub CloseDatabase 'Close connection to the database

con.Close
Set con = Nothing
Set rs = Nothing

End Sub
%>

-------------
showquestions.asp

Function PrintQuestions
Dim strSQL
Dim strTypeQuestion
Dim intCount

strTypeQuestion = ""
intCount = 0

Call Opendatabase(2)
strSQL = "select * from tblQuestions order by questiontype"
rs.Open strSQL, con
%>

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<form name="form1" method="get" action="score.asp">
<%
Do While Not rs.EOF
intCount = intCount + 1
If Not rs("QuestionType") = strTypeQuestion Then
strTypeQuestion = rs("QuestionType")
%>
</tr>
<tr>
<td>
</tr>
<tr>
<td><div align="left"><%=rs("QuestionType")%> </div>
<td><div align="center">1 </div>
<td><div align="center">2 </div>
<td><div align="center">3 </div>
<td><div align="center">4 </div>
</tr>
<tr>
<td>
</tr>
<%
End if
%>
<tr>
<td><%=rs("Question")%> </td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="1"> </div></td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="2"> </div></td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="3"> </div></td>
<td><div align="center"><input type="radio" name="question<%=rs("QuestionNo")%>" value="4"> </div></td>
</tr>
<%
rs.MoveNext
Loop
%>
<input type="hidden" name="questionCount" value="<%=intCount%>">
<input type="submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
</table>
<%
End Function


0

Response Number 3
Name: gpp
Date: June 23, 2004 at 06:25:13 Pacific
Reply:

Try putting the TR and TD tags around the buttons as well. Thats probably why they are floating at the top like that..


0

Response Number 4
Name: nascent (by mboto)
Date: June 24, 2004 at 02:51:01 Pacific
Reply:

Hi Gpp,

Can't belive i posted a message with something that stupid. Doh! Classic error. Spent ages looking for that one too. Thanks for pointing out the obvious.

Cheers,
Mboto


0

Response Number 5
Name: gpp
Date: June 24, 2004 at 05:24:25 Pacific
Reply:

The easiest ones are the hardest to catch! Glad I could help.

-gpp


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: asp page prints html bfore recrdset

i can't view asp pages on my IIS www.computing.net/answers/programming/i-cant-view-asp-pages-on-my-iis-/10275.html

Expiring a html page (ASP) www.computing.net/answers/programming/expiring-a-html-page-asp/7487.html

what is .asp file? www.computing.net/answers/programming/what-is-asp-file-/2188.html