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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP debuggin'please

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
0
0
GB
I'm having a recurring problem with this bit of code, i'd be gratefull if you could get me <br>on the right track.&nbsp;&nbsp;i've at it a week<br><br>The following is an example of what happens, I'm trying the same code to access a database constructed in ACCESS and a query made pasted into the ASP page:<br><br>SELECT SongTable.NameSong&nbsp;&nbsp;#basically displaying the songs from the song table#<br>FROM SongTable<br>ORDER BY SongTable.NameSong; # this is the query produced by access#<br><br>This is how I pasted the query into ASP, I wasn't clear from the book whether you make a literal copy<br><br>&lt;%<br><br>Dim oRS1<br>Set oRS1=Server.CreateObject(&quot;adodb.Recordset&quot;)<br>sqltext=&quot;SELECT SongTable.NameSong&quot;<br>sqltext=sqltext & &quot;FROM SongTable&quot;<br>sqltext=sqltext & &quot;ORDER BY SongTable.NameSong;&quot;<br>oRS1.Open sqltext, &quot;DSN=music&quot;&nbsp;&nbsp;&nbsp;&nbsp;# line 16 #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>Response.Write <br>Do While NOT oRS1.eof<br>Response.Write oRS1 (&quot;NameSong&quot;) & &quot;&lt;br&gt;&quot;<br>oRS1.MoveNext<br>loop<br>oRS1.Close<br>Set oRS1 = nothing <br>%&gt;<br><br>#And this is the error message I got, this seems to be my constant problem#<br><br>Microsoft OLE DB Provider for ODBC Drivers error '80040e14' <br><br>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'SongTable.NameSongFROM<br>SongTableORDER BY SongTable.NameSong'. <br><br>/muse1.asp, line 16 <br><br><br>I'd be gratefull for any hints,<br>
 
Try adding spaces between Song From and TableOrder Like :<br><br>sqltext = &quot;SELECT SongTable.NameSong&quot;<br>sqltext = sqltext & &quot; FROM SongTable&quot;<br>sqltext = sqltext & &quot; ORDER BY SongTable.NameSong;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&lt; Add Spaces Here<br><br>Thats what that error tells me.<br><br>~LS<br>
 
Well, the first problem is that when the sql statement is executed, you will find that there are NO spaces between your FROM and ORDER BY.&nbsp;&nbsp;basically, the sql statement looks like this when executed:<br><br>&quot;SELECT SongTable.NameSongFROM SongTableORDER BYSongTable.NameSong;&quot;<br><br>You need to put a space somewhere!&nbsp;&nbsp;<br><br>To assist in troubleshooting this, try doing a response.write sqltext.&nbsp;&nbsp;This will show you exactly what is trying to be executed.<br><br>G..
 
Thanks, That's it a simple space, cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top