firegryphon3207
05-23-2003, 05:17 PM
I'm back. And I've had lots of fun..sorta. I've posted on this issue before, but that question was more general and encompassed more that what I'm looking to address here.
This question is more about the specific code and how i'm pretty clueless reguarding what the pupose of one line is as it's the line that is throwing an error.
This is the code I have:
<%
' this part retrieves the users input from the form and assigns a variable to hold that value
dim subsearch
subsearch = Request.Form("s8search")
Response.write("s8search")%>
<%
' this connection code is styled similarly to the ones used on asp.com (i think).
'String1
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\firegryphon\db\mf_assistance_&_sec8_contracts.mdb")
' now you need to query the database using SQL and insert the variable as a search criteria.
' (note that there is an ORDER BY used here. that would only really apply to queries that...
' ... return more than 1 record. just so you know)
sql = "SELECT property_name_text, program_type_group_name, property_category_name, primary_financing_type, program_type_group_name " & _
"FROM MF_Properties_with_Assistance_&_Sec8_Contracts, MF_Assistance_&_Sec8_Contracts " & _
"WHERE (property_name_text = '" & subsearch & "')" & _
"ORDER BY property_name_text;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, cn, 3, 3
%>
<html>
<head>
<title></title>
</head>
<body>
<br>
<table border="1">
<tr>
<td width="20%"><b>field_1 Heading</b></td>
<td width="20%"><b>field_2 Heading</b></td>
<td width="20%"><b>field_3 Heading</b></td>
<td width="20%"><b>field_4 Heading</b></td>
<td width="20%"><b>field_5 Heading</b></td>
</tr>
<%
Do While Not rs.EOF
%>
<tr>
<td width="20%"><% = rs.Fields("property_name_text") %></td>
<td width="20%"><% = rs.Fields("program_type_group_name") %></td>
<td width="20%"><% = rs.Fields("property_category_name") %></td>
<td width="20%"><% = rs.Fields("primary_financing_type") %></td>
<td width="20%"><% = rs.Fields("program_type_group_name") %></td>
</tr>
<%
rs.MoveNext
Loop
%>
</table>
<%
' this part shuts it all down (regardless of which table you use)
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
</body>
</html>
The particular line that i'm having trouble with is:
rs.Open sql, cn, 3, 3
This code was originally written to return three fields, I need five fields, and i have no idea what this line does or how I should've changed it to suit.
Thanks in advance
:)
This question is more about the specific code and how i'm pretty clueless reguarding what the pupose of one line is as it's the line that is throwing an error.
This is the code I have:
<%
' this part retrieves the users input from the form and assigns a variable to hold that value
dim subsearch
subsearch = Request.Form("s8search")
Response.write("s8search")%>
<%
' this connection code is styled similarly to the ones used on asp.com (i think).
'String1
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\firegryphon\db\mf_assistance_&_sec8_contracts.mdb")
' now you need to query the database using SQL and insert the variable as a search criteria.
' (note that there is an ORDER BY used here. that would only really apply to queries that...
' ... return more than 1 record. just so you know)
sql = "SELECT property_name_text, program_type_group_name, property_category_name, primary_financing_type, program_type_group_name " & _
"FROM MF_Properties_with_Assistance_&_Sec8_Contracts, MF_Assistance_&_Sec8_Contracts " & _
"WHERE (property_name_text = '" & subsearch & "')" & _
"ORDER BY property_name_text;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, cn, 3, 3
%>
<html>
<head>
<title></title>
</head>
<body>
<br>
<table border="1">
<tr>
<td width="20%"><b>field_1 Heading</b></td>
<td width="20%"><b>field_2 Heading</b></td>
<td width="20%"><b>field_3 Heading</b></td>
<td width="20%"><b>field_4 Heading</b></td>
<td width="20%"><b>field_5 Heading</b></td>
</tr>
<%
Do While Not rs.EOF
%>
<tr>
<td width="20%"><% = rs.Fields("property_name_text") %></td>
<td width="20%"><% = rs.Fields("program_type_group_name") %></td>
<td width="20%"><% = rs.Fields("property_category_name") %></td>
<td width="20%"><% = rs.Fields("primary_financing_type") %></td>
<td width="20%"><% = rs.Fields("program_type_group_name") %></td>
</tr>
<%
rs.MoveNext
Loop
%>
</table>
<%
' this part shuts it all down (regardless of which table you use)
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
</body>
</html>
The particular line that i'm having trouble with is:
rs.Open sql, cn, 3, 3
This code was originally written to return three fields, I need five fields, and i have no idea what this line does or how I should've changed it to suit.
Thanks in advance
:)