When does the Dataset load?

  • Thread starter Thread starter Vayse
  • Start date Start date
V

Vayse

Lets say I create a databound Form with the datasource config wizard.
It has a Dataset -> TestDataSet, and two table adapters.
When the form loads, I have code like so

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PermissionsTableAdapter.Fill(Me.TestDataSet.Permissions)
Me.UsersTableAdapter.Fill(Me.TestDataSet.Users)
End Sub

I'm a bit unclear on the order of what happens. What are the steps?
Does the Dataset load the schema first, then the data?
Or does only the schema load, then the table adapters fill with the
necessary data?

Thanks
Vayse
 
In your code, the adapter is going to handle loading the schema and the data
so for all intents and purposes, they happen together. when you call Fill,
that's when the adapter moves the data but before it can move it, it looks
to the db to determine what the data looks like. If you have an untyped
dataset then it will build the tables , otherwise it will have to have
matching columns or table/column mappings - if not then it won't know where
to move them and will probably thrown an exception
 
Well, the wizard creates a typed Dataset, as far as I know.
So, the dataset is loaded first, so the adapter knows where to look for the
db?
 
If you're using typed datasets than the schema is already designed . Fill
is what triggers the data to be moved into the ds.
 
Back
Top