Click to See Complete Forum and Search --> : still confused but not toally lost


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
:)

firegryphon3207
05-23-2003, 09:54 PM
thanks! :) however, if I understand the article correctly, (recordset.Open Source, ActiveConnection, CursorType, LockType,) because I renamed the connection from cn to Conn that line should read
rs.Open.sql, Conn, 3, 3 ?

Or am I missing something else very important here? (as is often the case in client side scripting?)

This line keeps throwing this error

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

/firegryphon/results.asp, line 24
Line 24 being the line in question

firegryphon3207
05-23-2003, 10:38 PM
you are correct good sir, there is a typo in my post and no period between open and sql.
I suck at sql, as you may have already noticed, and I'm just not seeing the error. Either I'm missing because I'm frustrated, or I'm missing because I'm clueless.

firegryphon3207
05-24-2003, 09:40 PM
Great :D Opened a whole new can of worms, but I'm that much closer! You da man :D Thanks!!!!!

firegryphon3207
05-25-2003, 01:50 AM
I'm just hoping I'll run out of cans soon ;)