Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: C# How to access Objects in a Collection

Reply
Thread Tools

Re: C# How to access Objects in a Collection

 
 
Kevin Spencer
Guest
Posts: n/a
 
      08-13-2003
dgThreads.DataSource = ds.Tables["Threads"];

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"James Zhuo" <> wrote in message
news:...
> Hi all
>
> I have been developing some web apps using VB.NET for a coupla month.
>
> Until recently I have tried to use C# instead of VB. What i find is that

in
> VB.NET, Collections can be accessed using the dictionary approach for
> example ds.Tables("Threads") as below
>
> Dim DBConnection As New OleDbConnection = "blah .. .. . .. "
> Dim DBCommand As New OleDbCommand(DBQueryString, DBConnection)
> Dim DBAdapter As New OleDbDataAdapter(DBCommand)
> Dim DSThreads As New DataSet()
> DBConnection.Open()
> DBAdapter.Fill(DSThreads, "Threads")
> DBConnection.Close()
> --> dgThreads.DataSource = ds.Tables("Threads")
> dgThreads.DataBind()
>
> What I want to know is how I would do the same thing ds.Tables("Threads")
> using C#. I want to retrieve the table "Threads" that is store in the
> dataset. ds.Tables is a a property that returns a DataTableColletion.

There
> seem to be no straight forward way to access the DataTable that is

contained
> in the collection.
>
> Please help, any suggestion is much appreciated.
>
> Cheer
>
> J
>
>



 
Reply With Quote
 
 
 
 
James Zhuo
Guest
Posts: n/a
 
      08-13-2003
I love u guys. Thanx so much.

Cheer

J


"Kevin Spencer" <> wrote in message
news:%...
> dgThreads.DataSource = ds.Tables["Threads"];
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Neither a follower nor a lender be.
>
> "James Zhuo" <> wrote in message
> news:...
> > Hi all
> >
> > I have been developing some web apps using VB.NET for a coupla month.
> >
> > Until recently I have tried to use C# instead of VB. What i find is that

> in
> > VB.NET, Collections can be accessed using the dictionary approach for
> > example ds.Tables("Threads") as below
> >
> > Dim DBConnection As New OleDbConnection = "blah .. .. . .. "
> > Dim DBCommand As New OleDbCommand(DBQueryString, DBConnection)
> > Dim DBAdapter As New OleDbDataAdapter(DBCommand)
> > Dim DSThreads As New DataSet()
> > DBConnection.Open()
> > DBAdapter.Fill(DSThreads, "Threads")
> > DBConnection.Close()
> > --> dgThreads.DataSource = ds.Tables("Threads")
> > dgThreads.DataBind()
> >
> > What I want to know is how I would do the same thing

ds.Tables("Threads")
> > using C#. I want to retrieve the table "Threads" that is store in the
> > dataset. ds.Tables is a a property that returns a DataTableColletion.

> There
> > seem to be no straight forward way to access the DataTable that is

> contained
> > in the collection.
> >
> > Please help, any suggestion is much appreciated.
> >
> > Cheer
> >
> > J
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
create collection of collection Hemant ASP .Net 1 10-22-2009 03:04 PM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Øyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
class objects, method objects, function objects 7stud Python 11 03-20-2007 06:05 PM
Sorting the Collection(java.util.Collection) of Elements Pradeep Java 2 01-24-2007 02:33 PM
STL - an algorithm for finding a collection within a collection? Dylan C++ 5 03-22-2005 01:31 AM



Advertisments