D
dennist
I have a good friend named Steve Wiesner, a quantum
physicist. You can read about him in The Code Book, in
which he's described as the father of quantum
cryptology. I've acquired a layman's understanding of
what Einstein called "spooky action at a distance."
However, quantum entanglement is child's play compared to
instantiation of datasets.
Here's a bit of code that works, although I don't know
why.
NewTopic = False
Try
cn.Open()
Catch er As Exception
MessageBox.Show("Type = " &
er.GetType.ToString & vbCr & "Message = " & er.Message)
End Try
'Dim da As OleDbDataAdapter = New OleDbDataAdapter
'Dim ds As New DataSet
'ds.DataSetName = "ds1"
'cn.Open()
'da.FillSchema(ds, SchemaType.Source, "Topics")
'''cn.Close()
'ds.WriteXmlSchema("H:\HasbaraNET\ado.net
tests\H:\HasbaraNET\ado.net tests\Kevin
corrections\TFSNet2\TFSNet2\ds.xsd")
Dim cmd As New OleDbCommand("SELECT * FROM
Topics", cn)
Dim da As OleDbDataAdapter = New OleDbDataAdapter
da.SelectCommand = cmd
' Fill the DataSet
Dim ds As DataSet = New DataSet
ds.DataSetName = "ds1"
da.FillSchema(ds, SchemaType.Source, "Topics")
ds.WriteXmlSchema("H:\HasbaraNET\ado.net
tests\Kevin corrections\TFSNet2\TFSNet2\ds.xsd")
Dim dsA As New ds1
da.Fill(dsA, "Topics")
First, note that the dataset is ds, and the name of the
dataset is ds1. When I make this a strongly typed
dataset in code, I don't instantiate ds, I just use it,
ending up with ds.xsd(and going through the awkward
xsd.exe in console mode).
However, in order to use the dataset, I don't instantiate
it. I don't, for example, dim dsA as new ds. I
instantiae its NAME. If I try to instantiate the actual
dataset, I get an error.
If I don't have to instantiate it at all to create a
strongly typed dataset in code, why can't I just use it,
e.g. da.fill(ds, "Topics)? Even more bizarre, why do I
have to instantiate it's NAME, and fill it's NAME, not
the actual dataset.
Nobel prize winning quantum physicist Richard Feynman
said "Nobody really understands quantum mechanics."
Well, I don't really understand instantiation
requirements for datasets. Can somebody explain to me
what's really going on here, so when I do it I'm not just
doing it by rote?
thank you.
dennist
physicist. You can read about him in The Code Book, in
which he's described as the father of quantum
cryptology. I've acquired a layman's understanding of
what Einstein called "spooky action at a distance."
However, quantum entanglement is child's play compared to
instantiation of datasets.
Here's a bit of code that works, although I don't know
why.
NewTopic = False
Try
cn.Open()
Catch er As Exception
MessageBox.Show("Type = " &
er.GetType.ToString & vbCr & "Message = " & er.Message)
End Try
'Dim da As OleDbDataAdapter = New OleDbDataAdapter
'Dim ds As New DataSet
'ds.DataSetName = "ds1"
'cn.Open()
'da.FillSchema(ds, SchemaType.Source, "Topics")
'''cn.Close()
'ds.WriteXmlSchema("H:\HasbaraNET\ado.net
tests\H:\HasbaraNET\ado.net tests\Kevin
corrections\TFSNet2\TFSNet2\ds.xsd")
Dim cmd As New OleDbCommand("SELECT * FROM
Topics", cn)
Dim da As OleDbDataAdapter = New OleDbDataAdapter
da.SelectCommand = cmd
' Fill the DataSet
Dim ds As DataSet = New DataSet
ds.DataSetName = "ds1"
da.FillSchema(ds, SchemaType.Source, "Topics")
ds.WriteXmlSchema("H:\HasbaraNET\ado.net
tests\Kevin corrections\TFSNet2\TFSNet2\ds.xsd")
Dim dsA As New ds1
da.Fill(dsA, "Topics")
First, note that the dataset is ds, and the name of the
dataset is ds1. When I make this a strongly typed
dataset in code, I don't instantiate ds, I just use it,
ending up with ds.xsd(and going through the awkward
xsd.exe in console mode).
However, in order to use the dataset, I don't instantiate
it. I don't, for example, dim dsA as new ds. I
instantiae its NAME. If I try to instantiate the actual
dataset, I get an error.
If I don't have to instantiate it at all to create a
strongly typed dataset in code, why can't I just use it,
e.g. da.fill(ds, "Topics)? Even more bizarre, why do I
have to instantiate it's NAME, and fill it's NAME, not
the actual dataset.
Nobel prize winning quantum physicist Richard Feynman
said "Nobody really understands quantum mechanics."
Well, I don't really understand instantiation
requirements for datasets. Can somebody explain to me
what's really going on here, so when I do it I'm not just
doing it by rote?
thank you.
dennist