How to access a dataset value?

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I have a dataset which returns only one row.
I need to make an ASP:Image ImageURL equal to the dataset's imageURL
field.

I tried these two options:

iphoto.ImageURL = dsProduct("image01_url").ToString()
iphoto.ImageURL = dsProduct.Item("image01_url").ToString()

Both return an error. I know the second one works with a DataReader.

Can you tell me what am I doing wrong?

Thanks,
Miguel
 
Hi, You have to specify the datatable, indexes of row and column.

<dataset>.<datatable>.Rows(<rowIndex>)(<column index>).ToString();

For instance,

iphoto.ImageUrl=
dsProduct.Tables("Products").Rows(1)("Image01Url").ToString();
 

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

Back
Top