Solved

Session Dataset Value Get?

Posted on 2006-06-26
5
386 Views
Last Modified: 2008-01-16
I need to get a single value from a session dataset, but so far no luck.

I know data exists because I can merge this dataset with another dataset and save it to a database.

Here are my attempt:

DataSet ds = (DataSet)Session["mydataset"];

       string Product = Session["Product"].ToString();


0
Comment
Question by:kvnsdr
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:brdrok
ID: 16987169
Perhaps only a typo???

string Product = ds["Product"].ToString();
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 16987434
That's closer, but now I recieve an error:

Cannot apply indexing with [] to an expression of type 'System.Data.DataSet'

I've also tried:  string Product = ds.Tables[0].Columns[5].ToString();

then for the result I get the column name:  col_Product

I know the data is there, but...
0
 
LVL 7

Accepted Solution

by:
brdrok earned 250 total points
ID: 16987527
i believe you'll have to specify the row number...try the following:

string Product = ds.Tables[0].Rows[0][5].ToString();

where the [0] <= row number
where the [5] <= column number
0
 
LVL 7

Expert Comment

by:brdrok
ID: 17001878
do you mind if i ask why the grade of "B"?
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 17003057
Sorry, I goofed........
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question