Click to See Complete Forum and Search --> : [RESOLVED] Girl in trouble needs asp/sql help


Nacirema
11-03-2006, 10:04 AM
Hello all,

I have serious problem and I really need some help for classic asp on iis5.1

Please explain to me what is this:

set rsProds=OpenRecordSet(db, sqlLstProds, 1,3)

what does 1,3 signify?

My second questions is I have this code:

<%

sqlListProds = "SELECT * " & _
"FROM TBL_PRODUCT_DEFINITION AS pdef " & _
"INNER JOIN TBL_PRODUCT AS ptype ON pdef.IDProduct = ptype.IDProduct " & _
"WHERE (IDProductCriteria = 5 ) " & _
"AND ([Value] = '"&getSession("ModelID")&"') " & _
"AND (validated = 1) " & _
"ORDER BY IDProduct, IDProductCriteria"

set rsProds=OpenRecordSet(db, sqlLstProds, 1,3)

%>

and I get this error: ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.

the offending line of code is:

Do While not rsProds.eof

I have been having this problem for sooo long many days and I don't know what else to do.

Someone Plzzzzzz help.

so_is_this
11-03-2006, 10:50 AM
Please explain to me what is this:

set rsProds=OpenRecordSet(db, sqlLstProds, 1,3)

what does 1,3 signify?
That is an old DAO method: OpenRecordSet Method (http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/output/F1/D2/S5A2D0.asp)
You really need to switch to the current ADO methods: ADO Reference (http://msdn.microsoft.com/library/en-us/ado270/htm/mdmscadoapireference.asp)

I get this error: ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.

the offending line of code is:

Do While not rsProds.eof
Just based on the code you posted, there is not enough information given to resolve the problem. The error message indicates that the record set is not open at that point in the code. Using ADO, you would need something like the following first:

Dim conn, rsProds, sqlListProds
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open("...connection string...")

Then, you could do this:

sqlListProds = "SELECT * " & _
"FROM TBL_PRODUCT_DEFINITION AS pdef " & _
"INNER JOIN TBL_PRODUCT AS ptype ON pdef.IDProduct = ptype.IDProduct " & _
"WHERE (IDProductCriteria = 5 ) " & _
"AND ([Value] = '"&getSession("ModelID")&"') " & _
"AND (validated = 1) " & _
"ORDER BY IDProduct, IDProductCriteria"

Set rsProds = conn.Execute(sqlLstProds)

russell
11-03-2006, 01:16 PM
set rsProds=OpenRecordSet(db, sqlLstProds, 1,3)

another possibility is
since there is no object b4 the OpenRecordSet call, it is likely a custom function. search the file (and any included files) for a method of that name.

so_is_this
11-03-2006, 01:19 PM
You're correct. I missed that point. So, only this part of what I said is pertinent:

"Just based on the code you posted, there is not enough information given to resolve the problem. The error message indicates that the record set is not open at that point in the code."

Nacirema, you have to back up from there (from the DO statement) to find the problem.

russell
11-03-2006, 01:23 PM
if that's it, would need to see the function to know what the 1 and 3 are, but are probably rs constants adOpenKeyset and adLockOptimistic

russell
11-03-2006, 01:24 PM
im not saying u missed the point at all. just another thing she can look into. and you posted links to references that should help. nice call

edit:: and i misread your last post.... :)

russell
11-03-2006, 01:29 PM
also
right after this line

sqlListProds = "SELECT * " & _
"FROM TBL_PRODUCT_DEFINITION AS pdef " & _
"INNER JOIN TBL_PRODUCT AS ptype ON pdef.IDProduct = ptype.IDProduct " & _
"WHERE (IDProductCriteria = 5 ) " & _
"AND ([Value] = '"&getSession("ModelID")&"') " & _
"AND (validated = 1) " & _
"ORDER BY IDProduct, IDProductCriteria"

do a response.write sqlListProds

that will help identify the problem

Nacirema
11-03-2006, 02:50 PM
Thanks everyone
I did a response.write for the recordset and found the problem.
it was my movenext.

Thanks again!

so_is_this
11-03-2006, 07:37 PM
Salud!