472,791 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

Session variables not being picked up by sqldatasource HELP!

I'm being driven nuts by what I'm sure is a simple solution, I have to pass
some user and company id variables between 2 pages and on the second page
use the params in a SQL query to list all items for that company.

I set up the pages simply at first and could see the variables were being
passed. When I added my gridview and sqldatasource nothing happened and it
looks like the datasource is not picking up the session variable and I'm
stumped as I can see the variable fine on screen as per my code below.

Any help gratefully received


Jim Florence

On the first page, (I added 77 as a variable I knew would return results)

Session("Company") = 77
Session("usr") = strUser

On the second page

This shows the variables have been carried across OK, and I can see them
fine on the screen

Dim companytst, usr
companytst = Session("Company")
usr = Session("usr")
Response.Write("company id")

This is the query I set up and the session parameter is set to pick up the
session variable Company

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
Asset_Details.Current_Contract_id_sf_rf, Asset_Details.Description_mf_cb_hd,
Asset_Details.Current_Job_No_rf, Asset_Details.Current_Installation_id_ao,
CONVERT (varchar(11), Asset_Details.Last_On_Hire_Date_rf, 106) AS Expr1,
Job_Details.Client_Reference FROM Asset_Details LEFT OUTER JOIN Job_Details
ON Asset_Details.Current_Job_No_rf = Job_Details.Job_No_hd_sf_cb_rf_nn WHERE
(Asset_Details.Current_Company_id_sf_ao = @Company) ORDER BY
<asp:SessionParameter Name="Company" SessionField="Company"

Oct 25 '06 #1
0 2049

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: NETUser2004 | last post by:
Hello, I am carrying some values into a page using Session object. I would like to remove the session values that I used on this page when the user leaves to another page. But I need these...
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
by: Jim McGivney | last post by:
Session state is a collection. Is it possible to either add or retrieve a value from Session State by specifying an index number in place of a key ? If the Session State is initialized with:...
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page...
by: jobs | last post by:
I've got a page with Formview that has a sqldatasource doing a compicated select with a bunch of session parameter variables set in a calling page. 1. Is there anyway to response.write all...
by: Terry On Windigo | last post by:
I think I have figured out my problem but I don't know how to solve it. We are going to start using a forums package and do not want our users to have to login to both our site, and then again to...
by: Aarchaic | last post by:
Hello i have problem my session variables seem to disapear as i go along i've created this code to ilustrate whats happening First off i just post 3 detials like a name a age and a favourite...
by: Rick | last post by:
We are in the process of testing a large web project that I converted from VS 2003 to VS 2005. Everything seems to be working except for a few minor things. But the main issue I have is this, I...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.