DataSets (C#)

Discussion in 'ASP .Net' started by =?Utf-8?B?Qw==?=, Mar 5, 2005.

  1. Hi,

    I am using DataSets to populate some controls on my ASPX.

    I retrieve some values using the Index in my DataSets.

    For example dsTest.Tables[0].Rows[0].ItemArray[0] etc etc

    How can I retrieve the value using the Column name /alias used in my SQL
    rather than my Index.

    Thanks,
    Clive.
     
    =?Utf-8?B?Qw==?=, Mar 5, 2005
    #1
    1. Advertising

  2. Just replace the index with the column name (i.e. ...Rows["SomeCol"]...).

    "C" <> wrote in message
    news:...
    > Hi,
    >
    > I am using DataSets to populate some controls on my ASPX.
    >
    > I retrieve some values using the Index in my DataSets.
    >
    > For example dsTest.Tables[0].Rows[0].ItemArray[0] etc etc
    >
    > How can I retrieve the value using the Column name /alias used in my SQL
    > rather than my Index.
    >
    > Thanks,
    > Clive.
     
    Peter Rilling, Mar 5, 2005
    #2
    1. Advertising

  3. Use:
    dsTest.Tables[0].Rows[0]["columnname"]
    or
    dsTest.Tables[0].Rows[0].Item["columnname"]

    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - FrontPage

    "C" <> wrote in message
    news:...
    > Hi,
    >
    > I am using DataSets to populate some controls on my ASPX.
    >
    > I retrieve some values using the Index in my DataSets.
    >
    > For example dsTest.Tables[0].Rows[0].ItemArray[0] etc etc
    >
    > How can I retrieve the value using the Column name /alias used in my SQL
    > rather than my Index.
    >
    > Thanks,
    > Clive.
     
    Mark Fitzpatrick, Mar 5, 2005
    #3
  4. =?Utf-8?B?Qw==?=

    Karl Seguin Guest

    dsTest.Tables[0].Rows[0]["FirstName"]

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    "C" <> wrote in message
    news:...
    > Hi,
    >
    > I am using DataSets to populate some controls on my ASPX.
    >
    > I retrieve some values using the Index in my DataSets.
    >
    > For example dsTest.Tables[0].Rows[0].ItemArray[0] etc etc
    >
    > How can I retrieve the value using the Column name /alias used in my SQL
    > rather than my Index.
    >
    > Thanks,
    > Clive.
     
    Karl Seguin, Mar 5, 2005
    #4
  5. Actaully, it should be something like ...Rows[0]["SomeCol"]...

    "Peter Rilling" <> wrote in message
    news:%...
    > Just replace the index with the column name (i.e. ...Rows["SomeCol"]...).
    >
    > "C" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I am using DataSets to populate some controls on my ASPX.
    >>
    >> I retrieve some values using the Index in my DataSets.
    >>
    >> For example dsTest.Tables[0].Rows[0].ItemArray[0] etc etc
    >>
    >> How can I retrieve the value using the Column name /alias used in my SQL
    >> rather than my Index.
    >>
    >> Thanks,
    >> Clive.

    >
    >
     
    Peter Rilling, Mar 5, 2005
    #5
  6. =?Utf-8?B?Qw==?=

    Karl Seguin Guest

    You still need the row index in there ;)

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    "Peter Rilling" <> wrote in message
    news:%...
    > Just replace the index with the column name (i.e. ...Rows["SomeCol"]...).
    >
    > "C" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I am using DataSets to populate some controls on my ASPX.
    > >
    > > I retrieve some values using the Index in my DataSets.
    > >
    > > For example dsTest.Tables[0].Rows[0].ItemArray[0] etc etc
    > >
    > > How can I retrieve the value using the Column name /alias used in my SQL
    > > rather than my Index.
    > >
    > > Thanks,
    > > Clive.

    >
    >
     
    Karl Seguin, Mar 5, 2005
    #6
  7. dsTest.Tables[0].Rows[0]["ColumnName"]

    --
    Gregory A. Beamer
    MVP; MCP: +I, SD, SE, DBA

    *************************************************
    Think outside the box!
    *************************************************
    "C" <> wrote in message
    news:...
    > Hi,
    >
    > I am using DataSets to populate some controls on my ASPX.
    >
    > I retrieve some values using the Index in my DataSets.
    >
    > For example etc etc
    >
    > How can I retrieve the value using the Column name /alias used in my SQL
    > rather than my Index.
    >
    > Thanks,
    > Clive.
     
    Cowboy \(Gregory A. Beamer\), Mar 6, 2005
    #7
    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. Andreas
    Replies:
    5
    Views:
    564
    Mike Treseler
    May 31, 2005
  2. news.microsoft.com
    Replies:
    0
    Views:
    450
    news.microsoft.com
    Apr 12, 2006
  3. Francisco Garcia
    Replies:
    2
    Views:
    486
    Fran Garcia
    Apr 13, 2006
  4. news.microsoft.com
    Replies:
    0
    Views:
    199
    news.microsoft.com
    Apr 12, 2006
  5. Francisco Garcia
    Replies:
    3
    Views:
    264
    vincent
    Apr 13, 2006
Loading...

Share This Page