118-c-sharp-sql-database-connection

This example is for Microsoft SQL Server 2008 database connection.

First step is to make right click in Solution Explorer and Add->New Item…

c-sharp-database-connection01-a

Then, choose Service-based Database.

c-sharp-database-connection02

Choose a Database Model.

c-sharp-database-connection03

Choose your Database Object.

c_sharp_database_connection-04

Once when Data Connection is made and refreshed, new table can be added.

c-sharp-database-connection05

First column supposed to be ID column, should be of int type, and not allow Nulls.

c-sharp-database-connection06

In Column properties, identity specification should be clicked, and then Is Identity property should be changed to yes.

c-sharp-database-connection07

If you have no Microsoft SQL Server 2008, then Local Database is also an option.
c-sharp-database-connection08

For MySQL Database connection read in external links.

External links:

C Sharp SQL Database Connection on Daniweb
C Sharp SQL Database Connection on Codeproject
C Sharp MySQL Database Connection on Codeproject

Posted in c-sharp-code-examples

Leave a Reply

Your email address will not be published. Required fields are marked *

*