Killersites.com Homepage Welcome Guest   |   Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help



Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 6116 times and has 2 replies Next Thread
Male aspuser2008
Stranger




Joined: Jun 6, 2008
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

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>&nbsp;</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>

[Jun 6, 2008 11:55:05 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aspuser2008
Stranger




Joined: Jun 6, 2008
Post Count: 2
Status: Offline
Reply to this Post  Reply with Quote 
Re: Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

Anyone would know what am I doing wrong here??

What am I missing?
[Jun 9, 2008 11:13:08 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

According to the error, the issue appears to be with these two lines of code:

SQLQUERY=SQLQUERY & "cbxProgType= '" & field2 &"'"

...

SQLQUERY=SQLQUERY & "cbxAcadLevel= '" & field3 & "'"


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
[Jun 9, 2008 11:25:22 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread