-
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
-
Just put a space before the WHERE and it should solve your problem
Cheers!
Abhijit:)
-
Doh! :eek: How silly of me
-
I hate it when that happens :c)