Entity Framework Approach To Connect To Microsoft SQL Server 2008 using Visual C#The following is the procedure, with snapshots, for connecting to SQL Server and Visual C#.Step 1: Create a Console Application: DB_School_Application1.
Step 2: Right-click on DB_School_Application1 and a class called Student.Step 3: Add a class called Students to DB_School_Appliaction1 and its been added here.Step 4: Declare the variables of Student Class and Set Properties and save.Step 5: Add one more class called Context.Step 6: The class Context has been successfully added to DB_School_Application1.Step 7: Right-click and add a new folder for adding the Framework DLL (Dynamic Link Library).Step 8: Rename the folder Added as you want.Step 9: Before adding the Framework save the application as shown.Step 10: Right-click on the Program.cs file and select properties for copying the address of the Program's something.Step 11: In the Properties window right-click and copy the address of the programs for adding the DLL framework.Step 12: After copying, paste into the C: Drive bar and locate the folder you added previously.Step 13: Add the DLL Entity Framework to the folder you created, here it is: Entity Framework libStep 14: Now right-click on References and select Add References to browse to the DLL Entity FrameworkStep 15: Browse and Select then click Know DLL File has been added successfully.Step 16: Now the Entity Framework DLL is showing in the References menu. In the Context Class declare the Student Class and set the properties as shown.Step 17: Right-click on DB_School_Application1 and select "New Item..." | "Add" as shown for adding the Application Configuration File.Step 18: The Application Configuration file has been added successfully as shown.Step 19: In the App.Config File, declare the DB path and Database name as shown.Step 20: In the main programs file, declare Context and Student objects. Add the data to the Student object as shown in the figure.Step 21: Now it is almost finished. Just press F5 to execute. It will show that the DB has been successfully created in SQL Server.Step 22: Now login to SQL Server to view DB_School_Application.Step 23: Yes, now in SQL Server, DB School has been created successfully.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: