Advertisement

05.19.2008 at 04:39AM PDT, ID: 23413317 | Points: 500
[x]
Attachment Details

Problems With Searching an Access Database

Asked by WavyGravy in Active Server Pages (ASP)

Tags: ,

I am using the following code to search an Access database.  The idea is that on the page that submits the data, any drop down that has a blank area, or "Any" selected with search the SQL database as a wildcard.  However, when I try this, I am getting type mismatch errors.  Any ideas?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
<%
Dim qRS, querySQL
Dim flowstream, grade, color, gauge, width, length
 
 
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("sfsDb.mdb")
Set qRS = Server.CreateObject("ADODB.Recordset")
 
flowstream = Request.Form("flowstream")
grade = Request.Form("grade")
color = Request.Form ("color")
gauge = Request.Form("gauge")
width = Request.Form("width")
length = Request.Form("length")
 
IF flowstream = "Any" OR "" THEN
	flowstream = "?"
END IF
 
IF grade = "Any" OR "" THEN
	grade = "?"
END IF
 
IF color = "Any" OR "" THEN
	color = "?"
END IF
 
IF gauge = "Any" OR "" THEN
	gauge = "?"
END IF
 
IF width = "Any" OR "" THEN
	width = "?"
END IF
 
IF length = "Any" OR "" THEN
	length = "?"
END IF
 
querySQL = "SELECT flowstream, grade, color, gauge, width, length FROM inventory WHERE flowstream = '"& flowstream &"' AND color = '"& color &"' AND gauge = '"& gauge & "' AND width = '"& width & "' AND length = '"& length &"';"
qRS.Open querySQL, objConn
%>
<table>
	<tr>
    	<td>Flowstream</td>
        <td>Grade</td>
        <td>Color</td>
        <td>Gauge</td>
        <td>Width</td>
        <td>Length</td>
    </tr>
<%
Do While not qRS.EOF
%>
	<tr>
    	<td><%= qRS("flowstream") %></td>
        <td><%= qRS("grade") %></td>
        <td><%= qRS("color") %></td>
        <td><%= qRS("gauge") %></td>
        <td><%= qRS("width") %></td>
        <td><%= qRS("length") %></td>
    </tr>
<%
qRS.MoveNext
Loop
%>
</table>
[+][-]05.19.2008 at 04:43AM PDT, ID: 21596810

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 05:10AM PDT, ID: 21596999

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 08:04AM PDT, ID: 21598418

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 12:24PM PDT, ID: 21600732

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 12:26PM PDT, ID: 21600752

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 12:43PM PDT, ID: 21600896

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628