Reputation: 630
If I understand this right, do I have to use the table adapters to get data into my typed data set, I can't just create my strongly typed data-set and have the data autoload? (im also using a .net 3.5 project in VS2012)
for example, I have to do this to get data (If I do it this way, I get data)
var a = new EvtDataSetTableAdapters.tblFileTableAdapter();
a.GetData();
versus just doing this, (if I do it this way, I get nothing... and I could understand if its lazy loading...??)
EvtDataSet o = new EvtDataSet();
var r = o.tblFile.Select();
Upvotes: 2
Views: 1431
Reputation: 1641
The much maligned, much misunderstood strongly typed dataset!
Typically yes you would use a TableAdapter
to load the data, and to perform updates.
Using the designer you would add parameter queries to the table adapter to support the operations your program requires eg select * from customers where customerid = @customerid
Call this FillbyCustomerid
.
Then you would pull the data for the selected customer using the TableAdapter
by something along the lines of:
dim ta as new dscustomerstableadapters.customertableadapter
dim ds as new dsCustomers
ta.fillbycustomerid (ds.customers, ourid)
Upvotes: 0
Reputation: 62093
BEST usage of typed dataset: Ignore, never use. Go OTM instead. Use LINQ. Datasets - typed and untyped - where bad when they were in .NET 1.0, since then even MS has realized alternatives. Not used one in 10 years, not going to use one.
Exception: Reporting applications where the SQL is "entered externally", so you basically just Need a generic data Container.
Use EntityFramework or one of the tons of alternatives.
Upvotes: 0
Reputation: 273179
All DataSets (type and untyped) are database-agnostic, ie any DataTable can be filled from Oracle just as easy as from MS-Sql. The DataSet has no knowledge of schema or connection strings.
You need an Adapter to read to/from a backing store.
(And DataTable.Select() is probably from Linq-to-Datasets).
Upvotes: 1