I am using win2k server, access 2000 and IIS 5. The page will display the contents of the database but when I click refresh I get the unspecified error message and the line reference is to my DSN. I have double checked the DSN and the database and everything seems right. Here is what I have so far:
<%
Dim DataConn, cmdDC, rsDC
Dim Item
Dim iFieldCount, iLoopVar
Dim strSortBy, strOrder
strSortBy = Request.QueryString("sortby"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
If strSortBy = "" Then strSortBy = "gettime"
strOrder = Request.QueryString("order"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
' Create and establish data connection
Set DataConn = Server.CreateObject("ADODB.Connection"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
DataConn.ConnectionTimeout = 15
DataConn.CommandTimeout = 30
'Access connection code
'DataConn.Open "Test"
DataConn.Open "prod_timings"
' Create and link command object to data connection then set attributes and SQL query
Set cmdDC = Server.CreateObject("ADODB.Command"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
cmdDC.ActiveConnection = DataConn
cmdDC.CommandText = "SELECT * FROM Table1 ORDER BY " & strSortBy & strOrder
cmdDC.CommandType = 1
' Create recordset and retrieve values using command object
Set rsDC = Server.CreateObject("ADODB.Recordset"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)
rsDC.Open cmdDC, , 0, 1
%>
<html>
<head>
<title>Production Timings</title>
</head>
<body>
<p><strong><u>Production Timings Report</u></strong></p>
<p>
<strong>Sorted By: <%= strSortBy %></strong><br>
<strong>Ordered By: <%= strOrder %></strong>
</p>
<table border="1">
<thead>
<tr>
<% For Each Item in rsDC.Fields %>
<th bgcolor="#C0C0C0"><%= Item.Name %></th>
<% Next %>
</tr>
</thead>
<%
' Loop through recordset and display results
If Not rsDC.EOF Then rsDC.MoveFirst
' Get the number of fields and subtract one so our loops start at 0
iFieldCount = rsDC.Fields.Count - 1
' Continue till we get to the end, and while in each <TR> loop through fields
Do While Not rsDC.EOF
%> <tr>
<% For iLoopVar = 0 to iFieldCount %>
<td><%= rsDC.Fields(iLoopVar) %></td>
<% Next %>
</tr>
<%
rsDC.MoveNext
Loop
%>
</table>
<%
' Close Data Access Objects and free DB variables
rsDC.Close
Set rsDC = Nothing
Set cmdDC = Nothing
DataConn.Close
Set DataConn = Nothing
%>
<br>
<strong>Build your own query:</strong>
<form action="<%= Request.ServerVariables("URL"
%>" method="get">
Sort By:
<select name="sortby">
<option value="gettime">gettime</option>
<!-- <option value="dow">dow</option>
<option value="month">month</option>
<option value="time">time</option> -->
</select>
<select name="order">
<option value="">Ascending
<option value=" DESC">Descending
</select>
<br>
<input type="submit" value="Run Query"/>
</form>
</body>
</html>
Any ideas on why the page is erroring out after I hit the refresh button?
<%
Dim DataConn, cmdDC, rsDC
Dim Item
Dim iFieldCount, iLoopVar
Dim strSortBy, strOrder
strSortBy = Request.QueryString("sortby"
If strSortBy = "" Then strSortBy = "gettime"
strOrder = Request.QueryString("order"
' Create and establish data connection
Set DataConn = Server.CreateObject("ADODB.Connection"
DataConn.ConnectionTimeout = 15
DataConn.CommandTimeout = 30
'Access connection code
'DataConn.Open "Test"
DataConn.Open "prod_timings"
' Create and link command object to data connection then set attributes and SQL query
Set cmdDC = Server.CreateObject("ADODB.Command"
cmdDC.ActiveConnection = DataConn
cmdDC.CommandText = "SELECT * FROM Table1 ORDER BY " & strSortBy & strOrder
cmdDC.CommandType = 1
' Create recordset and retrieve values using command object
Set rsDC = Server.CreateObject("ADODB.Recordset"
' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)
rsDC.Open cmdDC, , 0, 1
%>
<html>
<head>
<title>Production Timings</title>
</head>
<body>
<p><strong><u>Production Timings Report</u></strong></p>
<p>
<strong>Sorted By: <%= strSortBy %></strong><br>
<strong>Ordered By: <%= strOrder %></strong>
</p>
<table border="1">
<thead>
<tr>
<% For Each Item in rsDC.Fields %>
<th bgcolor="#C0C0C0"><%= Item.Name %></th>
<% Next %>
</tr>
</thead>
<%
' Loop through recordset and display results
If Not rsDC.EOF Then rsDC.MoveFirst
' Get the number of fields and subtract one so our loops start at 0
iFieldCount = rsDC.Fields.Count - 1
' Continue till we get to the end, and while in each <TR> loop through fields
Do While Not rsDC.EOF
%> <tr>
<% For iLoopVar = 0 to iFieldCount %>
<td><%= rsDC.Fields(iLoopVar) %></td>
<% Next %>
</tr>
<%
rsDC.MoveNext
Loop
%>
</table>
<%
' Close Data Access Objects and free DB variables
rsDC.Close
Set rsDC = Nothing
Set cmdDC = Nothing
DataConn.Close
Set DataConn = Nothing
%>
<br>
<strong>Build your own query:</strong>
<form action="<%= Request.ServerVariables("URL"
Sort By:
<select name="sortby">
<option value="gettime">gettime</option>
<!-- <option value="dow">dow</option>
<option value="month">month</option>
<option value="time">time</option> -->
</select>
<select name="order">
<option value="">Ascending
<option value=" DESC">Descending
</select>
<br>
<input type="submit" value="Run Query"/>
</form>
</body>
</html>
Any ideas on why the page is erroring out after I hit the refresh button?