Results 1 to 4 of 4

Thread: ASP Error

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    181

    ASP Error

    Can someone tell me why this piece of code generated an error if i send the following URL to it:
    prodinfo.asp?type=tiles&name=interface
    (I have a table called tiles and a record for interface)

    Code:
     
    <html>
    <body>
    <%
    
    	Dim objRS
    	Dim objConn
    	Dim strLocation
    	Dim PType
    	Dim PName
    
    	strLocation = Server.MapPath("/db/products.mdb")
    
    	Set objConn = Server.CreateObject("ADODB.Connection")
    
    	objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strLocation & ";"
    
    	PType = Request.QueryString("type")
    	PName = Request.QueryString("name")
    
                    Set objRS = objConn.Execute ("SELECT * FROM " & Request.QueryString("type") & "WHERE Name = " & Request.QueryString("name"))
    	
    	Response.Write ("<div align=center>")
    	Response.Write ("<font face='Tahoma' size=5 color=Navy>")
    	Response.Write PName
    	Response.Write ("<hr width=100><br><font size=3>")
    	
    	If objRS.Fields("ImageLocation") <> "" Then
    		Response.Write ("<table border=0 width='100%'>")
    			Response.Write ("<tr>")
    				Response.Write ("<td width='67%' valign='top' align='justify'>" & objRS.Fields("Information") & "</td>")
    				Response.Write ("<td width='33%'><img border=0 src=" & objRS.Fields("ImageLocation") & " align='right' width='200' height='200'></td>")
    			Response.Write ("</tr>")
    		Response.Write ("</table>")
    
    	Else
    		Response.Write objRS.Fields ("Information")
    	End If
    
    	Response.Write ("<br><hr width=100><br>")
    	Response.Write ("Website: " & objRS.Fields("Website"))
    
    %>
    
    </body>
    </html>
    The bold part produced a syntax error with the FROM command

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Arrow

    Just put a space before the WHERE and it should solve your problem

    Cheers!
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    181
    Doh! How silly of me

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    I hate it when that happens :c)
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width