Windows app with database - what is best practice in C#?

T

TerryStone

I am writing a Windows application, with an SQL Server (Express)
database. The application is single user. The Windows application is
the only application that accesses the database.

I have been programming Windows application for years, but using Visual
C++. With C++ I would create a database class inherited from
CDaoDatabase, that encapsulated all the database storage I required.
The database class would make use of many recordset classes. The
database class would have functions like:

bool Open();
void Close();
bool AddUser( CUser* pUser );
bool LoadUsers( CListCtrl* plst );

There would be no access to the database unless it was through the
database class.

Now I have been dropped into the world of C#, and have been trying to
find the equivilent classes for CDaoDatabase and CDaoRecordset, and I
suspect there arn't any. And the majority of examples I've found bind
a dataset to a control, with little code to examine.

What is best practice? Should I create a Database class based on
SqlConnection, and create a DataSet for every table in the database?

My thanks to anyone who reads this.

Terry.
 
A

AAJ

Hi Terry

I dont know if this will be any help, but I had a similar problem.

I started off writing all my own Business logic classes, which then used my
own database access classes, but I found getting the datagrids etc difficult
to work properly.

I managed to find a tutorial which proved invaluable

http://www.asp.net/learn/dataaccess/default.aspx?tabid=63

It takes you though the table adapters, writing your own BLL code,
interfacing with the GUI and interfacing with your classes.

I hope it helps

Andy
 

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