Data Connection in Visual Studio


  • Hi,

    I am new to Visual Studio and Database. 

    Now, we wanna create database locally. Can we just under "data connection" and add table. Does that mean we created database.

    Or we have to locally host database or something?

    Wednesday, August 31, 2016 7:08 AM


  • Hi k31453,

    We could create database to SQL Server through VS. There are two scenarios that create database through VS. Please refer to the following steps:

    1). If you have a SQL Server in your machine, we could create a database to it through VS.

    Click VIEW menu->Server Explorer->right click Data Connections->Create New SQL Server Database

    Then input your Server name and New database name, after this step there would be a new database added to SQL Server Database. Please refer to the following screenshot:

    2). We could also create a new local database file through VS. First you could create a new WinForm or WPF project.

    Right-click the name of project->choose Add->New Item->choose Server-based Database-> Add

    Then a .mdf file will be added to solution explorer and we could create Tables to it in Server EWxplorer

    See more information about creating a local database file please refer to the following MSDN document:



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, September 1, 2016 5:14 AM