.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Creating mdf database in .net framework

Posted By:Ashutosh Jha       Posted Date: February 25, 2014    Points: 200    Category: .Net Framework    URL: http://www.dotnetspark.com  

How to create database and tables in .NET itself.
 

Here i will be explaining how we can create database in .net framework itself without using SQL Server database. For this please follow below written steps-

1. Right click on website/solution folder in solution explorer and select Add new item from that.

2.Select Database file from that and give some name. It will have extension as .mdf.

3.now your database has been created with the name (suppose abc.mdf).

4. Now open database explorer and there you will find the abc.mdf, open it and right click on table and add new table. Here you can create your table and save it. While saving it will ask for the table name give that and save.

5. Now create connection string as the below-

<connectionStrings>

    <add name="conn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\abc.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

  </connectionStrings>

 

6. Now you can do all the connection as you are doing in sql server.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend