Rhexis
Rhexis

Reputation: 2552

Convert/Turn Database into A Dataset for C#

iv been following tuts on learnvisualstudio.net and im confused as to how you get a dataset from a database. is there someway to "convert" a database into a dataset making it easier to access? (rather than using ADO.NET 2.0)

Thanks in advance.

EDIT:

never mind its all good now :D

Upvotes: 1

Views: 886

Answers (2)

Steav
Steav

Reputation: 1486

Yes there is a way to "import" your database schema to your application.

It's called strong typed Dataset, which will contain datatables with the same datatypes as your database. (for example: dtCustomerRow).

After importing your Database Schema to a typed Dataset you will have to use so called "TableAdapters" to load the Data.

Warning: This technique is handy, but also bad on performance.

Tutorial (is for asp.net, but also works for win forms):

http://weblogs.asp.net/scottgu/archive/2006/01/15/Building-a-DAL-using-Strongly-Typed-TableAdapters-and-DataTables-in-VS-2005-and-ASP.NET-2.0.aspx

Upvotes: 2

Smudge202
Smudge202

Reputation: 4687

You might be referring to ORM's. They can derive domain entity models from your database, and with thanks to Linq (amongst other things) you can then get much simpler access to your datasource, beit a database, RSS feed, XML document, etc.

I'd recommend taking a look at one of the following (both Microsoft tecnologies, but be aware there are many excellent - and free - alternatives available):

Linq To Sql:

Tutorial 1

Tutorial 2

Entity Framework 4:

Tutorial 1

Tutorial 2

If you are not interesting in leaning ORM's yet, then perhaps you are referring to Typed Datasets? - As suggested by @Henk Holterman

Upvotes: 2

Related Questions