This is the updated code that I'm using:
strQuery="SELECT TB1, TB2 FROM Guestbook"
Only recieving information from TB2 now; TB1 doesn't appear in the results.
I don't see anything else wrong with the ASP code. The page does not cache
and has a visitor counter, so I know I'm see up-to-date information. Below
is the page code. It's long.
<% @Language=VBScript %>
<html dir=ltr>
<head>
<title>View Guest Book</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" bottomMargin=0 leftMargin=0
rightMargin=0 topmargin=0 marginheight="0" marginwidth="0">
<%
Response.ExpiresAbsolute = #2000-01-01#
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, must-revalidate"
%>
<%
strQuery="SELECT TB1, TB2 FROM Guestbook"
'Database path statement describing the driver to use and the path to the
desired database.
strProvider = "Driver=Microsoft Access Driver (*.mdb);
DBQ=F:\RegWeb\Databases\guestbook.mdb;"
IF Request("ID") <> "" THEN
strIDNum=Request("ID")
'Creates an instance of an Active server component
set objConn = server.createobject("ADODB.Connection")
'Opens the connection to the data store
objConn.Open strProvider
'Instantiate Command object and use ActiveConnection property to attach
connection to Command object
set cm = Server.CreateObject("ADODB.Command")
cm.ActiveConnection = objConn
'Define SQL query
cm.CommandText = "DELETE FROM Guestbook WHERE ID = " &strIDNum
cm.Execute
END IF
'Instantiate a Recordset object and open a recordset using the Open method
Set rst = Server.CreateObject("ADODB.recordset")
rst.Open strQuery, strProvider
%>
<table border=1 cellspacing=0 cellpadding=0 width=260 bordercolor="#658BB0"
bgcolor="#E3EAF0">
<%
ON ERROR RESUME NEXT
IF rst.EOF THEN
Response.Write "There are no entries in the database."
ELSE%>
<%
WHILE NOT rst.EOF %>
<tr>
<%
'Response.Write "<td align=left valign=top bgcolor='#ffffff'>First Column
FIELD</td>"
FOR i = 1 to rst.fields.count - 1
Response.Write "<tr><td align=left valign=top bgcolor='#ffffff'>" &
rst(i)&"</td>"
NEXT
rst.MoveNext
WEND
END IF
%>
</table>
<% Set pageCount = Server.CreateObject("MSWC.PageCounter") %>
<% pageCount.PageHit %>
You are visitor number <% =pageCount.Hits %> to this Web site.
</body>
</html>
Dave said:
I did get a result, but not exactly what I need. I updated the code with a
comma; but the page only returns information
from TB2.
TB1 doesn't habla aspanol.
Dave
Bob Barrows said:
Well, you DO have to separate them by commas ...

strQuery="SELECT TB1, TB2 FROM Guestbook ORDER BY " &StrSort
Bob,
Tried it and received an error. Here's the code I'm using:
strQuery="SELECT TB1 TB2 FROM Guestbook ORDER BY " &StrSort
Here's the error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression 'TB1 TB2'.
/regweb/dpg/Content.asp, line 46
Here's line 46:
rst.Open strQuery, strProvider
Dave wrote:
Database with four fields. I only want to pull data from two
specific fields.
Can't think of the command to specify particular fields.
Dave
? Just list them in the Select clause of your query ... ?