asp_databases thread: Unspecified error when trying to use an access database with asp
I wrote a script in which users may search through a database. (I have
pasted my code below.) When I try to run the search, i get:
Provider error '80004005'
Unspecified error
/GITest/scripts/find.asp, line 16
If anyone can help me out, I would GREATLY appreciate it!
<<MY CODE>>
-----------------------------------------------------------------------
<%@ Language=VBScript %>
<%
Option Explicit
Response.Expires = 0
%>
<!--#include file="adovbs.inc"-->
<%
' Declare variables and open a connection to the database
Dim objConn, objRS, strQuery, ConnectionString
Dim strConn, strReq, searchAR
set objConn = Server.CreateObject("ADODB.Connection")
' strConn = "DSN=rd_issues;Database=rd_issues;"
ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);"
ConnectionString = ConnectionString & "DBQ=" & Server.MapPath
("rd_issues.mdb")
' objConn.open strConn
objConn.Open ConnectionString
'set objRS = Server.CreateObject("ADOB.Recordset")
' Read database information into record set
' -----------------------------------------
'strQuery = "SELECT * FROM rd_issues "
strQuery = "SELECT rd_issues.Date_Reported, rd_issues.Description, "
strQuery = strQuery & "rd_issues.Addressed, rd_issues.Date_Addressed, "
strQuery = strQuery & "rd_issues.Fix_Description FROM rd_issues "
' Determine what conditionals to use in query
' -------------------------------------------
'Case: Current unfixed issues
if Request.Form("fixed")= "no" then
strQuery = strQuery & "WHERE ([rd_issues.Addressed]=No)"
'Case: Either fixed issues or all issues
else
strQuery = strQuery & "WHERE "
if Request.Form("fixed") = "yes" then
strQuery = strQuery & "([rd_issues.Addressed]=Yes)"
end if
end if
' Add the category to the query if user does not choose all
if not Request.Form("type") = "0" then
strQuery = strQuery & " AND ([rd_issues.Category]="""
strQuery = strQuery & Request.Form("type") & chr(34)
end if
' Add user-supplied search terms if search is not empty
if not Request.Form("query") = "" and Request.form("exact")="0" then
'Parse the search string into an array so each term will be
seached for
searchAR = SPLIT(Request.Form("query"))
dim i
for i=0 to UBOUND(searchAR)
strQuery = strQuery & " AND Description LIKE '%"
strQuery = strQuery & searchAR(i)
strQuery = strQuery & "%'"
next
'else
' if Request.Form("query") = "" 'and Request.Form("exact")="1" then
' Search for entire string to find exact matches
' strQuery = strQuery & " AND Description LIKE '%"
' strQuery = strQuery & Request.Form("query")
' strQuery = strQuery & "%'"
' end if
end if
'strQuery = strQuery & ")"
' Organize data by date
strQuery = strQuery & " ORDER BY rd_issues.Date_Reported DESC"
'run query and store it in record set objRS
Set objRS = objConn.Execute(strQuery)
%>
<HTML>
<HEAD>
<title>Research Desktop - Search Results</title>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
' Print out table with correct number of columns
' ----------------------------------------------
' Case: Unfixed bug list only
if Request.Form("fixed")="No" then
%>
<font color=#000066><i><h2>Search Results</h2></i></font>
<table border=1 align=center>
<th align=center>Date Submitted</th>
<th>Description</th>
<%while not objRS.EOF%>
<tr>
<td width="15%" valign=top><font size=-1><%
Response.Write objRS("Date_Reported")%></font></td>
<td width="75%"><font size=-1><%
Response.Write objRS("Description")%></font></td>
<%objRS.MoveNext%>
</tr>
<%wend%>
</table>
<%
end if
' Case: Fixed bug list only
if Request.Form("fixed")=Yes then
%>
<font color=#000066><i><h2>Search Results</h2></i></font>
<table border=1 align=center width=100%>
<th align=center>Date Submitted</th>
<th align=center>Description</th>
<th align=center>Date Addressed</th>
<th align=center>Description of Solution</th>
<%while not objRS.EOF%>
<tr>
<td width="10%" valign=top> <font size=-
1><%Response.Write objRS("Date_Reported")%></font></td>
<td width="40%"><font size=-1><%
Response.Write objRS("Description")%></font></td>
<td width="10%" valign=top><%
Response.Write objRS("Date_Addressed")%></font></td>
<td width="40%"><font size=-1><%
Response.Write objRS("Fix_Description")%></font></td>
<%objRS.MoveNext%>
</tr>
<%wend%>
</table>
<%
' Case: All bugs
else%>
<font color=#000066><i><h2>Search Results</h2></i></font>
<table border=1 align=center>
<th align=center>Date Submitted</th>
<th align=center>Description</th>
<th align=center>Issue Resolved</th>
<th align=center>Date Addressed</th>
<th align=center>Description of Solution</th>
<%while not objRS.EOF%>
<tr>
<td width="10%" valign=top><font size=-1><%
Response.Write objRS("Date_Reported")%></font></td>
<td width="35%"><font size=-1><%
Response.Write objRS("Description")%></font></td>
<td width="10%" valign=top><font size=-1><%
Response.Write.objRS("Addressed")%></font></td>
<td width="10%" valign=top><font size=-1><%
Response.Write objRS("Date_Addressed")%></font></td>
<td width="35%"><font size=-1><%
Response.Write objRS("Fix_Description")%></font></td>
<%objRS.MoveNext%>
</tr>
<%wend%>
</table>
<%end if%>
</BODY>
</HTML>