By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,894 Members | 1,942 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,894 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.

Sep 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/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/....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
"TerryStone" <te*********@hotmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
>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.

Sep 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.