Re: C# How to access Objects in a Collection

Discussion in 'ASP .Net' started by Kevin Spencer, Aug 13, 2003.

  1. 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
    >
    >
     
    Kevin Spencer, Aug 13, 2003
    #1
    1. Advertising

  2. Kevin Spencer

    James Zhuo Guest

    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
    > >
    > >

    >
    >
     
    James Zhuo, Aug 13, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dylan
    Replies:
    5
    Views:
    436
    Daniel T.
    Mar 22, 2005
  2. Pradeep
    Replies:
    2
    Views:
    691
    Patricia Shanahan
    Jan 24, 2007
  3. 7stud
    Replies:
    11
    Views:
    725
    Dennis Lee Bieber
    Mar 20, 2007
  4. Øyvind Isaksen
    Replies:
    1
    Views:
    1,011
    Øyvind Isaksen
    May 18, 2007
  5. Hemant

    create collection of collection

    Hemant, Oct 22, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    430
    Gregory A. Beamer
    Oct 22, 2009
Loading...

Share This Page