Forums

This topic is locked

Filter Property

Posted 26 Apr 2001 00:45:47
1
has voted
26 Apr 2001 00:45:47 Scott Peterson posted:
I am having trouble using the Filter property in my ASP page.

Is there a way I can use a session variable in my Filter statement?

If I set up my statement like this using a string then it works:

Recordset1.Filter = "serialnumber= '0U812'"
Recordset1.Fields.Item("username".Value = Session ("user"
Recordset1.Update

How would I set it up to equal a session variable? Is it posible to set it up to equal a session variable?

If anyone knows where there is a tutorial showing this I would greatly appreciate it!

Clanggedin

Replies

Replied 26 Apr 2001 14:03:06
26 Apr 2001 14:03:06 Waldo Smeets replied:
Clanggedin,

in the Define Recordset dialog box you are able to select a filter. Choose the fieldname you want to filter on, and select Session Variable from the drop down menu that's right under the filter field.

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 26 Apr 2001 21:56:03
26 Apr 2001 21:56:03 Scott Peterson replied:
I have actually done that and it doesn't seem to have any effect.

I have 3 recordsets on this page. One is connected to the Insert Record behavior, while the other 2 are getting values.

Here is the effected code:

<%
set pra_id = Server.CreateObject("ADODB.Recordset"
pra_id.ActiveConnection = MM_Ident_STRING
pra_id.Source = "SELECT * FROM practice WHERE pra_addr_1 = ' " + addr1 + " '"
pra_id.CursorType = 0
pra_id.CursorLocation = 2
pra_id.LockType = 3
pra_id.Open()
pra_id_numRows = 0

set uspraid = Server.CreateObject("ADODB.Recordset"
uspraid.ActiveConnection = MM_Ident_STRING
uspraid.Source = "SELECT * FROM usr WHERE us_user_name = ' " + username + " '"
uspraid.CursorType = 0
uspraid.CursorLocation = 2
uspraid.LockType = 3
uspraid.Open()
uspraid_numRows = 0

practiceID = "900"

uspraid.Fields.Item("us_pra_id ".Value = practiceID
uspraid.Update
%>

I have practiceID set to a constant right now until I can fix this part, then it will receive the value from <b>pra_id.Fields.Item("pra_id".Value</b>

Every time I run the page I get this error:

*********************************************
ADODB.Fields error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/web-enabled/works2.asp, line 201

Line 201 is this <i>uspraid.Fields.Item("us_pra_id ".Value = practiceID</i>

What am I doing wrong?




Edited by - Clanggedin on 04/26/2001 21:59:52

Reply to this topic