hey, I have just ventured into the fun world of creating a search bar, so far i have a page which you type in a name of a band or album you like, the next page is meant to connect to the sql database and find matches that are LIKE the text entered. However I get an error instead.
ERROR code
here is the results page
I have a feeling the strsql string is incorrect but im unsure
ERROR code
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Oracle][ODBC][Ora]ORA-00933: SQL command not properly ended page/basic search.asp, line 16
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <%@LANGUAGE="VBSCRIPT"%> <% Dim strSQL, objConn, objRs strbasicsearch = Request.QueryString ("basicsearch") strsql = "select * from band and album where basicsearch like '"& strbasicsearch & "%'" Set objConn = Server.CreateObject("ADODB.Connection") objConn.open "dsn=Oracle;uid=username;pwd=password" Set objRs=objConn.execute(strSQL) %> <HTML> <HEAD> <TITLE> band Results Page</TITLE> <HEAD> <BODY> <TABLE> <TR> <TD>band name</TD> <TD>location </TD> <TD>genre</TD> <td>album</td> </TR> <% Do While Not (objRs.EOF) %> <TR> <TD><%=objRs("band_name")%></TD> <TD><%=objRs("location")%></TD> <TD><%=objRs("genre")%></TD> <TD><%=objRs("album_name")%></TD> </TR> <% objRs.MoveNext Loop objRs.Close Set objRs=Nothing objConn.Close Set objConn=Nothing %> </TABLE> </BODY> </HTML>
Comment