DataSets (C#)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Use:
dsTest.Tables[0].Rows[0]["columnname"]
or
dsTest.Tables[0].Rows[0].Item["columnname"]

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
Actaully, it should be something like ...Rows[0]["SomeCol"]...

Peter Rilling said:
Just replace the index with the column name (i.e. ...Rows["SomeCol"]...).

C said:
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.
 
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 said:
Just replace the index with the column name (i.e. ...Rows["SomeCol"]...).

C said:
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.
 
dsTest.Tables[0].Rows[0]["ColumnName"]

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

*************************************************
Think outside the box!
*************************************************
 
Back
Top