On the tab Server Explorer choose "Create New SQL Server Database".
Because we are using Database sql that was bundled with visual studio 2008, then we fill the server name with "sqlexpress", "dot" indicating we are looking the local machine.
Choose your authentication, whether "Windows Authentication" or "SQL Server Authentication".
Type your database name, we are here name it as "Apprentice_DB", and click "OK" button
- On tab Server Explorer choose "Apprentice_DB" and right click choose "Add New Table".
- Specify your Database table by fill in the "column_name","Data Type" and "Allow Nulls".
- After finish, click disk icon and you will be prompted the table name.
Teacher_ID in this table plays as the primary key, to make this field auto increment, click properties on this field and specify the identity specification and choose "Is Identity" to "Yes", so when you add new record this field would generate new numeric record consider to amount of the current record.
Create other table and name it "Apprentice_Table", just like previous table, make your parameter table or properties something like this
And the final step we are going to make relationship between the two tables that already being made !
Make the relationship like the picture above !
NB: Teacher_ID on Teacher_Table should have the column types as type as Teacher_Code on the Apprentice_Table.
After the relationship already being created, we could fill the record to the both of tables. You should fill the Teacher_Table at first because this table plays as master table that will being referred by Apprentice_Table.
After you finish on filling the record to the table, just press this button (Execute SQL), with pressing this button you would make change to database server
The Database that already being created was located at "C:\Program Files\MicrosoftSQL Server\MSSQL.1\Data" at this directory you would find "Apprentice_DB.mdf" and "Apprentice_DB_Log.LDF" both of files should exist in order to make the database work correctly.








0 comments:
Post a Comment