PART 3: Create New Database and Table for Entity Framework

This project is about storing and retrieving Book Details in the library so we will create database and table according to the project.
There are 5 parts in this project and this is 3rd Part.
PART 3:

Step 1:

Create Database LibraryDB. Open Server Explorer in Visual Studio. Go to View > Server Explorer.

Create Database for EF

Step 2:

Right Click on Data Connections and click on Create New SQL Server Database.

Create Database for EF

Step 3:

Give Server Name as follows and Create Database LibraryDB.

Step 4:

Add a New Table BookDetails in the database. Expand LibraryDB in server explorer and right click on Tables and click on Add New Tables.

Create Database for EF  

Step 5:

Create a table as mentioned in picture. After designing table click on Update button to save it into the database.

Create Database for EF

Step 6: SQL Script

CREATE TABLE [dbo].[BookDetails]
(
    [Id] INT NOT NULL PRIMARY KEY IDENTITY, 
    [BookName] NVARCHAR(50) NULL, 
    [Price] NVARCHAR(50) NULL, 
    [Category] NVARCHAR(50) NULL, 
    [AuthorName] NVARCHAR(50) NULL, 
    [Edition] NVARCHAR(50) NULL, 
    [BookCondition] NVARCHAR(50) NULL, 
    [Available] NCHAR(10) NULL
)

Summary:

In this chapter, you created SQL Database and a Table. In the next chapter, we will Install Entity Framework and Create Data Model.

More Articles

 

Share your thought



PLEASE DISABLE ADBLOCKER AND SUPPORT US!

Please support us by enabling ads on this page. Refresh

YOU DON'T LIKE ADS, WE ALSO DON'T LIKE ADS!
 
But we have to show ads on our site to keep it free and updated. We have to pay huge server costs, domain costs, CDN Costs, Developer Costs, Electricity and Internet Bill. Your little contribution will encourage us to regularly update this site.