Print Page | Close Window

Can anyone see whats wrong with this

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9564
Printed Date: 31 March 2026 at 11:22pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Can anyone see whats wrong with this
Posted By: ziwez0
Subject: Can anyone see whats wrong with this
Date Posted: 05 February 2004 at 9:13am

<%

Dim Conn, dbPath
dbPath = Server.MapPath("/htdocs/data/pricepannel.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & dbPath

Set UserRecordset = Server.CreateObject("ADODB.Recordset")
sqlstring = "select * from OceanClub"


UserRecordset.Open sqlstring, conn

While NOT UserRecordset.EOF
objthur1 = UserRecordset("thursday1")
objsun1 = UserRecordset("Sunday1")
obj4n = UserRecordset("4nts")
obj7n = UserRecordset("7nts")
obj10n = UserRecordset("10nts")
obj11n = UserRecordset("11nts")
obj14n = UserRecordset("14nts")

wend
UserRecordset.Close : Set UserRecordset=nothing
conn.close : Set conn=nothing
%>

 

its been awhile since ive been programming in asp, do i ned to set up a odbc connection? or is this a DNS LESS connection? i forgot -opps!

 



-------------
If anything takes long to do its worth doing.



Replies:
Posted By: Semikolon
Date Posted: 05 February 2004 at 9:34am

what is actually the problem? do you get an error?



Posted By: ziwez0
Date Posted: 05 February 2004 at 9:35am
it does not display any of the items that are in the database

-------------
If anything takes long to do its worth doing.


Posted By: Semikolon
Date Posted: 05 February 2004 at 9:42am

oh.. you havnt sent an output command to the server..

use response.write like this:

Response.Write(UserRecordset("thursday1"))
Response.Write(UserRecordset("Sunday1"))

instead of this

objthur1 = UserRecordset("thursday1")
objsun1 = UserRecordset("Sunday1")



Posted By: ziwez0
Date Posted: 05 February 2004 at 10:02am

Hi, oppps i have actually done it i just did not want to paste all of that code but here it is

 

<html>
<title>Ocean Club Price List</title>

<head>
<LINK href="/data/active.css" rel=stylesheet>

 

 


</head>

<body>
<table cellpadding=0 cellspacing=0 bgcolor="#D6E4FC" width="500">
<tr><td bgcolor="#000099"><img src="ocean_title.gif"></td></tr>
</table>

<TABLE border=0 height="250" WIDTH="500"  CELLPADDING=3 CELLSPACING=0 bgcolor="#D6E4FC" class="main_font">

<tr><td><b>Thursday Departures<br>(7, 10 or 14nts)</b></td>
<td><b>Sunday Departures<br>(7, 11 or 14nts)</b></td>
<td><b>4nts</b></td>
<td><b>7nts</b></td>
<td><b>10nts</b></td>
<td><b>11nts</b></td>
<td><b>14nts</b></td></tr>
<tr height='2'bgcolor="#000066"><td ></td><td ></td><td ></td><td </td><td></td><td></td><td& gt;</td></tr>

<%

 

 

Dim Conn, dbPath
dbPath = Server.MapPath("/htdocs/data/pricepannel.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & dbPath

Set UserRecordset = Server.CreateObject("ADODB.Recordset")
sqlstring = "select * from OceanClub"


UserRecordset.Open sqlstring, conn

While NOT UserRecordset.EOF
objthur1 = UserRecordset("thursday1")
objsun1 = UserRecordset("Sunday1")
obj4n = UserRecordset("4nts")
obj7n = UserRecordset("7nts")
obj10n = UserRecordset("10nts")
obj11n = UserRecordset("11nts")
obj14n = UserRecordset("14nts")


 Response.Write "<tr><td>" & objthur1 & "</td><td>" & objsun1 & "</td><td>" & obj4n & "</td><td>" & obj7n & "</td><td>" & obj10n & "</td><td>" & obj11n & "</td><td>" & obj14n & "</td></tr>"
Response.Write "<tr height='2'bgcolor='#000066'><td ></td><td ></td><td ></td><td </td><td></td><td></td><td& gt;</td></tr>"
    UserRecordset.MoveNext
wend
UserRecordset.Close : Set UserRecordset=nothing
conn.close : Set conn=nothing
%>


</TABLE>
<p>
<table>
<tr><td class="main_font">
Prices are per person and include flights, all taxes, transfers, accommodation and daily breakfast. Based on two perople sharing a twin room.
<br>Supplement for single room £7 per night.
</td></tr>
</table>
</body>
</html>



-------------
If anything takes long to do its worth doing.


Posted By: pmormr
Date Posted: 06 February 2004 at 8:37am
don't know if it'll make a difference, but make sure you always declare your object variables before you initialize them... (i.e. the recordset variable)

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: ziwez0
Date Posted: 06 February 2004 at 10:05am

Well the code actually has worked before, we have moved to a new host

i cant remember if i set up a ODBC connection, does the above need that, or is it just a DNS less connection <-- i think

-

David



-------------
If anything takes long to do its worth doing.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net