Programming in .NET – part 2 -database creation

Please read the first part at

The database will be, for Windows forms, Access , and for ASP.NET projects –
SQL Server Express.

Why this choice? Very simple.

For Windows forms, I need something to be easy deployed – and the most easy is
a file based database.

For the ASP.NET application, must be something that can answer queries fast –
and be reliable.(Access it is not a choice)

Moreover, the both databases must have the same standard query language- so
Access and SQL Server are clear as a good choice

How we will generate code to work to both, we will see.

The database will be created in C:\book\BookData folder(please create the

For those that do not have Access, please download the file from

Now start Acces => File = > New = > blank database

Save in the C:\book\BookData with the name book.mdb

I will show you the creation of the first table, leaving as an exercise for the
user the other tables.
As soon as you create DB, you are on the “Tables” tab – and click on “New”

Click on “design view”, then click on OK.


Now you can introduce values for as in figure:


For making IDAuthor Primary key, right click on the most left side, and then
click Primary Key.


After we create other tables, we must link them, to prevent erroneous data
entered in the database( example: a book with an publishing ID that does not
exist in publishing table)

For this, press Tools=> Relationships and select your tables and press OK

Now drag IDBook from Book table to the IDBook from Author_Book

Please select “referential entigrity” cascade update and delete

I let other relationship to the user. Close Relationship and save

Please  download the file from

Now , because we have finished with database creation, a word about the
organizing of the application.The folder C:\book
will contain:

BookData( mdb files, sql express scripts)
BookObjects( object and database connection)
BookWin( Windows project)
BookDos ( DOS project)
BookWeb(Web project)
BookDeployWeb(deployment Web)
BookDeployWin(deployment Windows)
BookDeploySmartClient(deployment-ul SmartClient)


On  28 August 2006 will be posted next part when we will wrote some
code in C#.


Leave a Reply

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