DataSets (C#)

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

Peter Rilling

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

Mark Fitzpatrick

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

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
P

Peter Rilling

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

Karl Seguin

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

Cowboy \(Gregory A. Beamer\)

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

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

*************************************************
Think outside the box!
*************************************************
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top