Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2006, 10:19 AM
Registered User
 
Join Date: Apr 2006
Location: middletown, ct, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query Result to Session Variable

I want to create session variables for Company and Role in the below query:

objConn.Open()
objCmd = New SqlCommand("SELECT Username, Company, Role FROM A_Users WHERE Username=@givenUsername", objConn)
objCmd.Parameters.AddWithValue("@givenUsername", Username)
objRdr = objCmd.ExecuteReader()

I am a CF Programmer new to .Net. So I am learning how to do .Net on the fly.

Your help is appreciated.

John
Reply With Quote
  #2 (permalink)  
Old April 6th, 2006, 11:15 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You have to loop through the reader and assign a value into a session variable.

session("Company") = readervalue .. Check the syntax on how to get the reader value.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get the execute query result in variable mahen_pali SQL Server 2005 2 April 7th, 2008 04:04 AM
how to put result of shell function into variable method Beginning VB 6 1 April 20th, 2006 11:42 AM
pass the result of a query to a variable ... eusebio Pro VB Databases 6 March 30th, 2006 07:41 PM
SQL query using a session variable nikcrazyivan Classic ASP Databases 0 March 8th, 2005 12:03 AM
Setting a Variable = Result of a SQL Query PeteS VB Databases Basics 1 June 20th, 2003 08:14 AM



All times are GMT -4. The time now is 05:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.