|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 3
|
|
| Author |
|
|
Stranger Joined: Jun 6, 2008 Post Count: 2 Status: Offline |
HI, I'm fairly new to asp, I'm trying to create a page that will allow users to search an access database that contains one table. They only will search for any of the three fields or a combination. below is some code that I'm trying to implement but i'm receiving the errro below Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'cbxProgType= ' ' andcbxAcadLevel= ' ''. /xx/newsearch.asp, line 128 I inserted the code below Can anyone help?? 'read parameters field1 = Request("Org") field2 = Request("ProgType") field3 = Request("AcadLevel") Dim cn,rs,SQLQUERY Set rs = Server.CreateObject("ADODB.recordset") ' opening connection ' Connection String accessdb="xx" cn="DRIVER={Microsoft Access Driver (*.mdb)};" cn=cn & "DBQ=" & server.mappath(accessdb) SQLQUERY="select * from cc" one_field=false if field1<>" " then SQLQUERY=SQLQUERY & " WHERE " SQLQUERY=SQLQUERY & "txtOrg= '" &field1 &"'" one_field = true end if if field2<>"" then if one_field = false then SQLQUERY=SQLQUERY & " WHERE " else SQLQUERY=SQLQUERY & " and" end if SQLQUERY=SQLQUERY & "cbxProgType= '" & field2 &"'" one_field = true end if if field3<>"" then if one_field = false then SQLQUERY=SQLQUERY & " WHERE " else SQLQUERY=SQLQUERY & " and" end if SQLQUERY=SQLQUERY & "cbxAcadLevel= '" & field3 & "'" one_field=true end if rs.open SQLQUERY, cn (line 128) %> <%'if there are no observations found display no record found if rs.eof then %> <% ' if observations are found display them else %> <table BORDER="1"> <tr> <td>Program</td> <% ' if the user clicked a link from a search ' display the detailed data titles %> </tr> <% rs.movefirst do while not rs.eof %> <tr> <td> <a href="<%=("ProgramProfile.asp") %>?ID=<%= rs("ID") %>"> <%= rs("txtProgram") %></a> </td> <% rs.MoveNext loop%> </table> <p> </p> <% ' end check for no input 'end if end if %> <body bgcolor="#FFFFFF"> <table> <tr><td> <form action="<%=request.servervariables("script_name") %>" method="post"> <select size="1" name="Org"> <option value=" ">Institution</option> <option value="College1"> College1</option> <option value=" College2"> College2</option> </select> <br> <select size="1" name="ProgType"> <option value=" ">Choose Program Type</option> <option value="education"> Education</option> <option value="research"> Research</option> <option value="work-study"> Work-study</option> <option value="internship/fellowship"> Internship/Fellowship</option> <option value="counseling"> Counseling</option> <option value="mentoring"> Mentoring</option> <option value="career/academic planning"> Career/Academic planning</option> </select> <br></br> <select size="1" name="AcadLevel"> <option value=" ">Academic Level</option> <option value="grades K-5"> Grades K-5</option> <option value="grades 6-8"> Grades 6-8</option> <option value="grades 9-12"> Grades 9-12</option> <option value="college"> College</option> <option value="professional school"> Professional School</option> <option value="medical school"> Medical School</option> <option value="graduate school"> Graduate school</option> <option value="post-doctoral level"> Post-doctoral Level</option> <option value="retraining"> Retraining</option> </select> <br> <p> <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p> </form> |
||
|
|
Stranger Joined: Jun 6, 2008 Post Count: 2 Status: Offline |
Anyone would know what am I doing wrong here?? What am I missing? |
||
|
|
Advanced Member USA Joined: Aug 14, 2007 Post Count: 1129 Status: Offline |
According to the error, the issue appears to be with these two lines of code: SQLQUERY=SQLQUERY & "cbxProgType= '" & field2 &"'"However, my specialty is not ASP, so I really can't tell you what is wrong with them. It looks fine to me...? Someone who knows ASP better hopefully can help. ---------------------------------------- Benjamin Falk | student : designer : developer Twitter: falkencreative |
||
|
|
|
|
|
Current timezone is GMT Mar 20, 2010 7:09:15 PM |