DataRow...Not getting it!

jesus4u

Well-known member
Joined
Feb 13, 2003
Messages
47
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?!

Code:
dsCRH.Tables("Broadcasts").Rows(0)("Title")
 
This is code I used to populate a list box on form_load.

[VB]
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
[/VB]

ailzaj
 
Code:
dsCRH.Tables("Broadcasts").Rows(0).Item("Title")
is equal to
Code:
dsCRH.Tables("Broadcasts").Rows(0)("Title")


so can you post some CODE !!
 
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 doesnt show anything, you have no data.

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

-nerseus
 
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*
 
Back
Top