dataset object reference

archer_coal

Well-known member
Joined
Apr 4, 2003
Messages
96
I have a project and used the oledbdataadapter wizard
then created a dataset using the Generate Dataset tool
when i "view dataset" in the Data tools all is well.
When i go to add code to the form using the dataset i get the following error

OleDbDataAdapter1.Fill(DataSet1)
Dataset1 is a type and cannot be used as a reference

also
when i try the following
Dataset1.Clear()
i get this error

Reference to a non-shared member requires and object reference

this is the first time ive used the wizard, normally i just code the sucker in there and bind it to the datagrid with no problems

what am i missing here?
 
Originally posted by archer_coal

OleDbDataAdapter1.Fill(DataSet1)

After this line have you got something like
tblStudents = dstStudents.Tables("Students")

What Public declarations have you got for the DataTables &
DataRows?

Have you selected the DataSource property of the DataGrid?

ailzaj
 
If you used the wizard and went with the defaults it has created a new class (based on the xsd) called Dataset1. The instance that gets created on the form has the usual control + number naming convention. If you look youll see its Dataset11.

Then again youre probably better of giving them a half decent name anyway.
 
me so stupiT

I cant believe i missed that

Why does it name it dataset11 when i called it dataset1?
No wonder it didnt happen when i coded it by hand lol
:D

Thanks for pointing that out for me.
 
Back
Top