Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a dataset filled with 1 and only 1 row in a table called Broadcasts.

 

How do I read the value from the Title column? This errors out saying that there is no row at 0 or the same message if I change it to 1.

 

Waz up?!

 

dsCRH.Tables("Broadcasts").Rows(0)("Title")

Alex Polajenko
Posted

This is code I used to populate a list box on form_load.

 

dstClasses.Clear()
adpClasses.Fill(dstClasses)           ' dataset for ClassID list box
tblClasses = dstClasses.Tables("Classes")

' load list box with values from ClassID column in Classes Table
For i = 0 To tblClasses.Rows.Count - 1
       lstClassID.Items.Add(tblClasses.Rows(i).Item("ClassID"))
Next

   drwStudents = tblStudents.Rows(0)      'first row in table

 

ailzaj

Posted

dsCRH.Tables("Broadcasts").Rows(0).Item("Title") 

is equal to

dsCRH.Tables("Broadcasts").Rows(0)("Title")

 

 

so can you post some CODE !!

Some people are wise and some are other-wise.
  • *Experts*
Posted

How can you be sure you have one row? Can you show us how you fill the DataSet?

 

Also, use dsCRH.GetXml() to see all the data in your dataset. If it doesn't show anything, you have no data.

 

You definitely want row 0, btw. All collections/arrays/etc. in .NET are 0-based.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Probably the Dataset is empty, as has been mentioned before.

 

Make use of the Direct Command Window

 

Then test for

 

dsCRSH.Tables.Count

dsCRSH.Tables(0).TableName

dsCRSH.Tables(0).Rows.Count

 

and so on.

 

Ups.

GetXML sounds even better.

 

*bows to Nerseus*

.nerd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...