V(ery) Basic
Sep 10th, 2000, 01:23 PM
Ok. This is my first ever ASP thing, and I'm making it with C++, because IIS sounds a bit out of my league.
Anyway, here's the code:
<HTML>
<HEAD>
<TITLE>The St Andrews University Football Website</TITLE>
</HEAD>
<BODY>
<!-- Open Players RecordSet->
<%
Dim rs, conn, sql, i
Set rs = Server.CreateObject("ADODB.Recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=http://www.st-and.ac.uk/~www_sem/economics/faculty/mlm/Players.mdb"
sql = "SELECT * FROM Players"
rs.Open sql, conn
Do
i = i + 1
rs.MoveNext
Loop While Not (rs.EOF)
rs.MoveFirst
%>
<!--Tell viewer how many people are playing and when->
<% If i = 0 Then %>
<H2> There are currently no people signed up to play football on
<% ElseIf i = 1 Then %>
<H2> There is currently 1 person signed up to play football on
<% ElseIf i > 1 Then %>
<H2> There are currently <% i %> people playing football on
<% End If
=rs.Fields(4).Value%>
</H1>
<P>
<!--Display signup form if more players are needed->
<font face="tahoma" size=3>
<% If i > 12 Then %>
Sorry, but no more players can be accepted
<% ElseIf i = 0 Then %>
Do you wish to sign up?
<br>
<hr>
<br>
Please enter your name here: <input type=Text name="PlayerName" size="20">
<br>
Please enter your e-mail address here: <input type=Text name="PlayerEmail" size="20">
<p>
<input type=submit value="Submit" name="Submit1">
<% ElseIf i > 0 and i < 13 Then %>
Do you wish to sign up if you haven't already?
<br>
<hr>
<br>
Please enter your name here: <input type=Text name="PlayerName" size="20">
<br>
Please enter your e-mail address here: <input type=Text name="PlayerEmail" size="20">
<p>
<input type=submit value="Submit" name="Submit1">
<% End If %>
<!--If somebody is already playing then display their names and e-mail addresses->
<% If i > 0 Then %>
Those already playing:
<Table ALIGN=center>
<tr>
<th> Name </th>
<th> E-mail Address </th>
</tr>
<% Do Until rs.EOF %>
<TR>
<TD><%= rs.Fields(1).Value & " " & rs.Fields(2).Value %></TD>
<TD><%= rs.Fields(3).Value %> </TD>
</TR>
<% rs.MoveNext
Loop
Set rs = Nothing
Set conn = Nothing
%>
</BODY>
</HTML>
Now when I convert this to VB, it all works hunky dory, but when it's in an ASP script, first of all, my computer said that I could either run it from its current location, or save it to disk (now that's not normal, is it?) and then it tried to open it with InterDev, and then when I put 'View in Browser' for that, it just loaded IE with a blank page.
The path for the DB is correct, I just want to know what the hell is the problem. Have I missed a '<' out or something.
Please help, it is kinda urgent.
Anyway, here's the code:
<HTML>
<HEAD>
<TITLE>The St Andrews University Football Website</TITLE>
</HEAD>
<BODY>
<!-- Open Players RecordSet->
<%
Dim rs, conn, sql, i
Set rs = Server.CreateObject("ADODB.Recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=http://www.st-and.ac.uk/~www_sem/economics/faculty/mlm/Players.mdb"
sql = "SELECT * FROM Players"
rs.Open sql, conn
Do
i = i + 1
rs.MoveNext
Loop While Not (rs.EOF)
rs.MoveFirst
%>
<!--Tell viewer how many people are playing and when->
<% If i = 0 Then %>
<H2> There are currently no people signed up to play football on
<% ElseIf i = 1 Then %>
<H2> There is currently 1 person signed up to play football on
<% ElseIf i > 1 Then %>
<H2> There are currently <% i %> people playing football on
<% End If
=rs.Fields(4).Value%>
</H1>
<P>
<!--Display signup form if more players are needed->
<font face="tahoma" size=3>
<% If i > 12 Then %>
Sorry, but no more players can be accepted
<% ElseIf i = 0 Then %>
Do you wish to sign up?
<br>
<hr>
<br>
Please enter your name here: <input type=Text name="PlayerName" size="20">
<br>
Please enter your e-mail address here: <input type=Text name="PlayerEmail" size="20">
<p>
<input type=submit value="Submit" name="Submit1">
<% ElseIf i > 0 and i < 13 Then %>
Do you wish to sign up if you haven't already?
<br>
<hr>
<br>
Please enter your name here: <input type=Text name="PlayerName" size="20">
<br>
Please enter your e-mail address here: <input type=Text name="PlayerEmail" size="20">
<p>
<input type=submit value="Submit" name="Submit1">
<% End If %>
<!--If somebody is already playing then display their names and e-mail addresses->
<% If i > 0 Then %>
Those already playing:
<Table ALIGN=center>
<tr>
<th> Name </th>
<th> E-mail Address </th>
</tr>
<% Do Until rs.EOF %>
<TR>
<TD><%= rs.Fields(1).Value & " " & rs.Fields(2).Value %></TD>
<TD><%= rs.Fields(3).Value %> </TD>
</TR>
<% rs.MoveNext
Loop
Set rs = Nothing
Set conn = Nothing
%>
</BODY>
</HTML>
Now when I convert this to VB, it all works hunky dory, but when it's in an ASP script, first of all, my computer said that I could either run it from its current location, or save it to disk (now that's not normal, is it?) and then it tried to open it with InterDev, and then when I put 'View in Browser' for that, it just loaded IE with a blank page.
The path for the DB is correct, I just want to know what the hell is the problem. Have I missed a '<' out or something.
Please help, it is kinda urgent.