Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp debugging

Status
Not open for further replies.

ade77

Technical User
Joined
Jul 17, 2000
Messages
4
Location
GB
I have just started using Asp, and I am having problems getting my first script to access data from a Access database. I would very much appreciate it, if anyone could suggest a solution or at least tell me why the fault is occuring. Whenever I try to run the script it returns the error messages: <br><br>Microsoft OLE DB Provider for ODBC Drivers error '80040e14' <br><br>[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause. <br><br>/test.asp, line 17 <br><br><br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Brigantia Directory Search Results&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;<br>&lt;b&gt;&lt;i&gt;&lt;font color=&quot;#000099&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;4&quot;&gt;Directory Search Results&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;<br><br>&lt;hr&gt;<br>&lt;p&gt;Next line from Ado will work if a DSN named brigantia has been set&lt;br&gt;<br>for the example database which is named brig.mdb.&lt;/p&gt;<br><br>&lt;% <br>&nbsp;set oRS=server.CreateObject(&quot;ADODB.recordset&quot;)<br>&nbsp;oRS.open &quot;select * from group&quot;, &quot;DSN=brigantia&quot;<br>&nbsp;oRS.MoveFirst<br>&nbsp;Response.Write &quot;&lt;b&gt;&quot; & oRS(&quot;BusinessName&quot;) & &quot;&lt;/b&gt;&quot;<br>%&gt;<br><br><br>&lt;hr&gt;<br>Finished test page&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><br>
 
Try this, notice where the DSN is being used:<br><br><br>'Establish a connection with data source&nbsp;&nbsp;&nbsp;&nbsp;<br>strDSN&nbsp;&nbsp;= &quot;FILEDSN=MyDatabase.dsn&quot;&nbsp;&nbsp;<br>&nbsp;&nbsp;<br>Set cn = Server.CreateObject(&quot;ADODB.Connection&quot;)&nbsp;&nbsp;<br>cn.Open strDSN<br>&nbsp;&nbsp;<br>'Instantiate a Recordset object&nbsp;&nbsp;<br>Set rsCustomers = Server.CreateObject(&quot;ADODB.Recordset&quot;)&nbsp;&nbsp;<br>&nbsp;&nbsp;<br>'Open a recordset using the Open method&nbsp;&nbsp;<br>' and use the connection established by the Connection object<br>&nbsp;&nbsp;<br>strSQL = &quot;select * from group&quot;<br>&nbsp;&nbsp;<br>rsCustomers.Open&nbsp;&nbsp;strSQL, cn &nbsp;&nbsp;<br><br><br>G..<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top