Hello

pickrs.Open cussql,conn

should be 
pickrs.Open sql,conn, adOpenForwardOnly,AdLockReadOnly

as that is the var you have in your function declaration

Cheers

Mark
-----Original Message-----
From: jim Hundley [mailto:[EMAIL PROTECTED]]
Sent: maandag 19 augustus 2002 17:24
To: ActiveServerPages
Subject: strange result from a select list function


I have a site that I am working on that is select list intensive so I
figured I'd be clever and write myself a very simple function to fill in
the <options> parts.  I'm new to building functions in ASP but I got it
to work eventually.  But on subsequent calls to the function I am still
getting the first option list.  

I have my function in a public.asp file :

function picklist(sql)
        dim picktemp
        set pickrs = server.createobject("adodb.recordset")
        pickrs.Open cussql,conn
        do until pickrs.EOF
        picktemp = picktemp & "<option value=" & pickrs.Fields(0) & ">"
& pickrs.Fields(1) &"</option>"
        pickrs.MoveNext
        loop
        set pickrs = nothing
        picklist = picktemp
end function

which I <!--#include file="public.asp" --> in the page in question.

Then I call it for a select list:

<SELECT id=customer name=customer>
<%
cussql = "select customerid, companyname from customers"
Response.Write picklist(cussql)
%>
</SELECT>

but when I call it later on the same page with a different SQL ( which
works as expected in query analyzer) I get the same listing:

<SELECT id=activity name=activity>
<%
actsql = "select activityid, activity from tblrefactivity"
Response.Write picklist(actsql)
%>
</SELECT>

I have a feeling I'm missing something very simple but I just can't see
it

Jim Hundley
Development
www.vbti.com


---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to %%email.unsub%%

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to