Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2005, 03:23 PM
Authorized User
 
Join Date: Jan 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Learning DataSets!

Hey, this is a easy question - I feel kinda dumb asking it but I am learing the concepts of DataSets and DataTables, etc.

I have a DataTable. I output the contents of a column like so:

Response.Write(DT.Rows[0].Table.Columns["ProductID"].ToString());

And the output is "ProductID", but not the value. If I do a simple databind to a datagrid I get this:

ID Quantity ProductID Cost Size Color
1 1 27 29.95 1 21

I want to retrieve the value! which is "1".

What am I doing wrong?
 
Old February 5th, 2005, 04:34 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

you should write,
Code:
DT.Rows[rowNumber][ColumnNumber or ColumnName].ToString();
Quote:
quote:DT.Rows[0].Table.Columns["ProductID"].ToString());
in this you wrote,
Rows[0].Table gives you the DataTable that contains Rows[0] then Columns["ProductID"].ToString() gives you the name of DataColumn(Columns["ProductID"]).

_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
 
Old February 5th, 2005, 04:52 PM
Authorized User
 
Join Date: Jan 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That makes sense now.

The dataset is a very complex and extensive .net component. I guess that is a good thing, but it sure makes it tuff to learn.

Thank you for your help.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Joining Two DataSets YiannisF General .NET 4 October 30th, 2008 06:38 AM
Find five Datasets rosejeep SQL Server 2000 1 November 9th, 2006 08:44 AM
Comparing two datasets vip1976 ADO.NET 1 December 2nd, 2005 01:42 AM
Datasets Louisa VB.NET 2002/2003 Basics 1 October 6th, 2004 07:38 AM
DataSets CodeMonkeys C# 1 September 7th, 2004 09:48 PM





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