It's great to finally join the greatness of Neowin :) I've just picked up scripting in VBScript, but I'm having a bit of a difficulty with the code below. Trying to display this ASP page shows error 500 in the browser. For the life of me I can't figure out where the problem is.
<%
<!--#include file="header.asp" -->
<!--#include file="peopleheader.asp" -->
<BR><br>
<%
Option Explicit
Dim objConn ' Our Connection Object
Dim objRS ' Our Recordset Object
Dim strSQL ' Our SQL String to access the database
Dim strConnection ' Our Connection string to access the database
Dim i ' a counter variable
' -- Create objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
' -- Connection String Value
strConnection = "DSN=data;"
' -- Open the Connection
objConn.Open strConnection
' -- Our SQL Statement
strSQL = "SELECT * FROM Data"
' -- Populate our Recordset with data
set objRS = objConn.Execute (strSQL)
if (objRS.BOF and objRS.EOF) then
response.write "No records found"
response.end
End if
response.write "<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='1' WIDTH='100%'>"
' -- Output the Field Names as the first row in the table
Response.Write "<TR BGCOLOR='"#CCCCCC"'>"
For i = 0 to objRS.Fields.Count - 1
Response.Write "<TH><FONT FACE='"ARIAL"' SIZE='"2"'> & objRS.Fields(i).Name & </FONT></TH>"
Next
Response.write "</TR>"
' -- Now output the contents of the Recordset
objRS.MoveFirst
Do While Not objRS.EOF
' -- output the contents
Response.Write "<TR>"
For i = 0 to objRS.Fields.Count - 1
Response.Write "<TD><FONT FACE='"ARIAL"' SIZE='"1"'> & objRS.Fields(i) & </FONT></TD>"
Next
Response.write "</TR>"
' -- move to the next record
objRS.MoveNext
Loop
response.write "</table>"
objRS.Close
set objRS = Nothing
objConn.Close
set objConn = Nothing
%>
<!--#include file="footer.asp" -->
%>
If anyone is able to offer some assistance with this it will be much appreciated. I'm kind of desperate :)
Question
vanx
Hello guys,
It's great to finally join the greatness of Neowin :) I've just picked up scripting in VBScript, but I'm having a bit of a difficulty with the code below. Trying to display this ASP page shows error 500 in the browser. For the life of me I can't figure out where the problem is.
<% <!--#include file="header.asp" --> <!--#include file="peopleheader.asp" --> <BR><br> <% Option Explicit Dim objConn ' Our Connection Object Dim objRS ' Our Recordset Object Dim strSQL ' Our SQL String to access the database Dim strConnection ' Our Connection string to access the database Dim i ' a counter variable ' -- Create objects Set objConn = Server.CreateObject("ADODB.Connection") Set objRS = Server.CreateObject("ADODB.Recordset") ' -- Connection String Value strConnection = "DSN=data;" ' -- Open the Connection objConn.Open strConnection ' -- Our SQL Statement strSQL = "SELECT * FROM Data" ' -- Populate our Recordset with data set objRS = objConn.Execute (strSQL) if (objRS.BOF and objRS.EOF) then response.write "No records found" response.end End if response.write "<TABLE BORDER='1' CELLPADDING='2' CELLSPACING='1' WIDTH='100%'>" ' -- Output the Field Names as the first row in the table Response.Write "<TR BGCOLOR='"#CCCCCC"'>" For i = 0 to objRS.Fields.Count - 1 Response.Write "<TH><FONT FACE='"ARIAL"' SIZE='"2"'> & objRS.Fields(i).Name & </FONT></TH>" Next Response.write "</TR>" ' -- Now output the contents of the Recordset objRS.MoveFirst Do While Not objRS.EOF ' -- output the contents Response.Write "<TR>" For i = 0 to objRS.Fields.Count - 1 Response.Write "<TD><FONT FACE='"ARIAL"' SIZE='"1"'> & objRS.Fields(i) & </FONT></TD>" Next Response.write "</TR>" ' -- move to the next record objRS.MoveNext Loop response.write "</table>" objRS.Close set objRS = Nothing objConn.Close set objConn = Nothing %> <!--#include file="footer.asp" --> %>If anyone is able to offer some assistance with this it will be much appreciated. I'm kind of desperate :)
Edited by vanxFixed thread title
Link to comment
Share on other sites
9 answers to this question
Recommended Posts