Author |
Topic  |
|
avyworld
Starting Member
USA
48 Posts |
Posted - 01 April 2001 : 17:43:30
|
I am trying to connect to my database that holds articles. Everything should work, but for some reason my SQL query does gets this error:
quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'properties'. Make sure it exists and that its name is spelled correctly.
/dbtestings/search/by-author.asp, line 18
The weirdest part is that I have an "Add an Article" page that works, and I copied the table name from that. Could someone please help? The code is below.
<%@ language="vbscript" %> <%
dim author
author = Request.QueryString("author")
dim oConn dim sSQL dim oRS
Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\dbtestings\db\articles.mdb")
sSQL = "SELECT * FROM properties WHERE author='" & author & "'"
Set oRS = oConn.Execute(sSQL)
%>
<html> <head> <title>Articles Written by <%=author%></title> <style type="text/css"> .header {font-size:14pt} </style> </head> <body bgcolor="#FFFFFF"> <div class="header">Articles Written By <%=author%></div>
<%
Do While NOT oRS.EOF
%>
<p><a href="../read-article.asp?title=<%=oRS("title").Value%>"><%=oRS("title").Value%></a>
<% Loop %>
</body> </html>
<% oRS.MoveNext %>
|
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 01 April 2001 : 19:10:10
|
my first thought would be that properties is a reserved word, so you should rename your table to something else.
|
 |
|
avyworld
Starting Member
USA
48 Posts |
Posted - 01 April 2001 : 20:20:52
|
Well, then why did it work in the other one? Also, how do you rename a table (using SQL)?
|
 |
|
Doug G
Support Moderator
    
USA
6493 Posts |
Posted - 01 April 2001 : 20:41:13
|
Try putting [ ] around the table name. This syntax will work with SQL Server and Access.
====== Doug G ====== |
 |
|
avyworld
Starting Member
USA
48 Posts |
Posted - 01 April 2001 : 20:54:26
|
How do I rename the table in SQL, though?
|
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 01 April 2001 : 21:42:37
|
For access, I think you would need to use some ado commands, since you can't rename a table using SQL, on SQL server you can execute a stored procedure.
|
 |
|
|
Topic  |
|