how to check if dataadapter has filled

Jamesmor

Member
Joined
Sep 27, 2010
Messages
5
Programming Experience
1-3
Background info:

.net framework 1.0
visual studio 2002 (using vb.net)
database was created in access 2000
i have access 2003 installed (don't know if it matters)

Issue:

not sure dataadapter is filling.

Using the toolbox I drug an oledbdataadapter to my form, set it up using the correct database connection.

clicked the data adapter, chose "generate dataset" from the properties screen

went through the process of creating the dataset.

when I click the "preview data" item for the data adapter under the properties, i can fill my dataset correctly.

however, when I try to bind a listbox to the dataset it remains blank (i do set the display member and display value for the list box)

i'm filling my data adapter using the .fill method in the form load sub.

what's strange is that if i use datasets that we're previously created, it works just fine, and i'm not entirely sure why.

any help would be greatly appreciated.
 
The DataAdapter.Fill method returns an Integer containing the number of rows retrieved. Test to see whether it's zero or not. If it's not zero then data is being retrieved.
 
well I've gotten it to work. not sure what is wrong though.

If i use the following (generic names used)

da.fill(bobcat1)

my items show in the list box.

if i use

da.fill(bobcat1, "bobcat")

my items don't show in the listbox.

the code that was left behind from the previous developer is all

da.fill(bobcat1, "bobcat")

Does that give you any more ideas as to what I could be doing wrong?
 
I've bound it both in the designer and the code.

My DataSource in the designer is Bobcat1 (I believe - I'm not at work right now) and was selected using the dropdown.
 
figured it out.

in the dataset i created (using designer) the table was called tblBobcat so i needed to use

da.fill(bobcat1, "tblBobcat")

instead of what i was using.

thanks for trying to help guys!
 
If you created the DataSet in the designer then it's a typed DataSet, so you should use it as such. A typed DataSet has a property for each DataTable, so your code should look like this:
VB.NET:
da.Fill(bobcat1.tblBobcat)
 
Back
Top