PC Review


Reply
Thread Tools Rate Thread

DataTable by name not index

 
 
M.H.
Guest
Posts: n/a
 
      12th Mar 2009
Hi there,

I have an SQL that returns number of datasets.
Something like that

SELECT * FROM A
SELECT * FROM B WHERE B_ID > 100

In my C# code I would like to access those two sets by a name instead
of index of a table

- Tables["A"], Tables["B"] instead of Tables[0], Tables[1].

How can I 'attach' a name to my DataTables?

MH
 
Reply With Quote
 
 
 
 
sloan
Guest
Posts: n/a
 
      13th Mar 2009

One way:

Create strong (typed) datasets, and populate them.



"M.H." <(E-Mail Removed)> wrote in message
news:O8M%(E-Mail Removed)...
> Hi there,
>
> I have an SQL that returns number of datasets.
> Something like that
>
> SELECT * FROM A
> SELECT * FROM B WHERE B_ID > 100
>
> In my C# code I would like to access those two sets by a name instead
> of index of a table
>
> - Tables["A"], Tables["B"] instead of Tables[0], Tables[1].
>
> How can I 'attach' a name to my DataTables?
>
> MH



 
Reply With Quote
 
M.H.
Guest
Posts: n/a
 
      14th Mar 2009
sloan wrote:

>
> One way:
>
> Create strong (typed) datasets, and populate them.


I'm too lazy for this.
It's why we have computers to make our job easier.

MH
 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      16th Mar 2009
Hi,

One way would be to populate table names in code right after the select is
done.
AFAIK You can't do it automatically thought.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com

"M.H." <(E-Mail Removed)> wrote in message
news:O8M#(E-Mail Removed)...
> Hi there,
>
> I have an SQL that returns number of datasets.
> Something like that
>
> SELECT * FROM A
> SELECT * FROM B WHERE B_ID > 100
>
> In my C# code I would like to access those two sets by a name instead
> of index of a table
>
> - Tables["A"], Tables["B"] instead of Tables[0], Tables[1].
>
> How can I 'attach' a name to my DataTables?
>
> MH


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Index on DataTable ? fniles Microsoft ADO .NET 2 19th Oct 2008 07:52 PM
Index on DataTable ? fniles Microsoft VB .NET 3 18th Sep 2008 09:53 PM
DataTable -> DataView -> Sort -> DataGrid : need related DataTable index Diamonds Microsoft ADO .NET 4 28th Jun 2006 08:23 PM
DataView index from DataTable index =?Utf-8?B?Unlhbg==?= Microsoft C# .NET 0 5th Nov 2004 10:49 PM
is it possible to add an index to a datatable object Norbert Microsoft Dot NET Compact Framework 1 17th Sep 2003 01:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:19 PM.