This topic is locked

USING the SESSION USER ID for a Chart Query

10/25/2009 5:53:00 PM
ASPRunnerPro General questions
C
Conrunner author

Hi

I am very bad with Classic ASP which is why I am using ASP Runner.

I have a chart which uses a query
Select from Table1

WHERE Table1.Date = Table2.Date
Table2 is a Table containing 2 Columns

Table2.USERID, and Table2.Date
The query works fine and the chart displays the data if there is only one row in Table2 because in this case there is only one value for Table2.Date.

For example

USERID, Date

Barney, 02-02-2009

The chart selects 02-02-2009 as the Date and shows the corresponding data.
If however there are more than one rows in Table2 (which there usually are - but ONLY ONE for EACH DIFFERENT USER) then the Chart cannot do this.

For example

USERID, Date

Barney, 02-02-2009

Jenny, 03-05-2009

This is because it does not know which Date to select. If I run the query on SQL Server it confirms this as it states that the query returned more than one value
The USERID field in Table2 is automatically populated by assigning it the Session("_" & strTableName &"_OwnerID") on the Edit Page for Table2.
What I really need to do in simple terms is to get the chart to perform the above query

Select
from Table1

WHERE Table1.Date = Table2.Date

BUT ALSO to tell it to only select one date from Table2 - ie; The Date in the row for the person who has JUST LOGGED IN.
I have tried all weekend to use the BeforeSQLQuery Event but am completely lost.
Please could you tell me how to do this? In simple language I want to ask the chart to select all data for the Date in Table2 where the USERID = the SESSION User ID (for the person who has just logged in) but just can't figure out the correct coding.
I really would be grateful if you could appreciate that I really know NOTHING re ASP and would be terrible grateful if you could take me through it step by step, assuming no knowledge.
Many Thanks

Con

J
Jane 10/26/2009

answered in your personal email.