What's the benefit of using VS.Net's "Generating Dataset..."?

This may be a newbie question.

I used to just define (VB.Net for example):

dim dt as new DataTable
dataAdp.fill(dt)

But in VS.Net,
You can also right click the SQLDataAdapter1 component and click
"Generating Dataset...", after specify a name, the new xsd file will be
created as well as a correspond vb file. The VB file basically created
another class inherit DataSet class.

But in the vb code, it seems still need to do:

dataApt.fill(AutoGeneratedDataset, "SameNameOfTheTableWhenGenerating")

What's the benefit to use this function of VS.Net? I know one is you can
use the visual tool to do data binding after you have generated dataset
placed on the form designer.... Others?
 
S

Scott Allen

Generating a DataSet produces a typed DataSet.

A typed DataSet derives from the DataSet class and inherits all the
methods, events, and properties of a DataSet. In addition, a typed
DataSet provides strongly typed methods, events, and properties.

Something written like:

ds.Tables["Employees"].Rows[0]["Employee_ID"];

you culd write as:

ds.Employees.Rows[0].Employee_ID;

Which is a bit more readable and less error prone.
You'll also have intellisense in the IDE to complete to help.

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top