473,385 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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

Regards

Jim Florence

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

Session("Company") = 77
Session("usr") = strUser
Response.Redirect("testpage.aspx")

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")
Response.Write(companytst)
Response.Write("user")
Response.Write(usr)

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 %>"
SelectCommand="SELECT
Asset_Details.Serial_Number_sf_hd_mf_cb_ao_uq,
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
Asset_Details.Serial_Number_sf_hd_mf_cb_ao_uq">
<SelectParameters>
<asp:SessionParameter Name="Company" SessionField="Company"
/>

Oct 25 '06 #1
0 2066

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

Similar topics

3
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...
10
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...
3
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:...
3
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...
2
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...
1
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...
5
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...
0
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...
14
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.