Forums

This topic is locked

Filtering from user logon. please help!!!!

Posted 19 Dec 2002 14:52:26
1
has voted
19 Dec 2002 14:52:26 James Wilkinson posted:
Any help would be fantastic as it been bugging me for days now.

I have 3 tables.
1. tbl_users - userID, firstname, lastname, company, username, password.
2. tbl_userpostcodes - userID, postCode
3. tbl_agents - name, address, postCode etc..

when the user logs on and goes into the Estate Agents section I want the estate agents data to filter LIKE all the postcodes against that users userID in tbl_userpostcodes. I need it to filter LIKE as the postcodes in tbl_userpostcodes are RG1, SN1 & the post codes in tbl_agents will be full post codes such as RG14 2KS & SN1 2EU.

This is my recordset:

SELECT * FROM tbl_agents WHERE PostCode IN(SELECT PostCode
FROM tbl_userPostCodes
WHERE userID = Session("MM_Username")

Also, I can test this in DWMX and it will work but when tested live I get error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/postcode/test.asp, line 20

Do you know what this could be??? I think it may not be getting the userID correctly??

Edited by - slink on 19 Dec 2002 15:55:57

Edited by - slink on 19 Dec 2002 17:30:02

Replies

Replied 23 Dec 2002 13:28:16
23 Dec 2002 13:28:16 David Behan replied:
If the name of the sql text is "sql_text" then use this to work out what is wrong...

Response.Write("sql_text"
Response.End

This will write the sql statement to the page for you to view. If the sql statement says after processing:

SELECT * FROM tbl_agents WHERE PostCode IN(SELECT PostCode FROM tbl_userPostCodes WHERE userID = ))

Then you need to check why the value is not been pulled in.

The other problem could be that you are using a username to filter a number field.

Regards,

Dave



_________________________
WinXP : IIS 5.1 : StudioMX : ASP : VBScript
www.clicksdesign.com

Reply to this topic