Connecting to SQL Server with Visual Studio Express Editions

Connecting to SQL Server with Visual Studio Express Editions

You should be able to choose the SQL Server Database file option to get the right kind of database (the system.data.SqlClient provider), and then manually correct the connection string to point to your db.

I think the reasoning behind those db choices probably goes something like this:

  • If you're using the Express Edition, and you're not using Visual Web Developer, you're probably building a desktop program.
  • If you're building a desktop program, and you're using the express edition, you're probably a hobbyist or uISV-er working at home rather than doing development for a corporation.
  • If you're not developing for a corporation, your app is probably destined for the end-user and your data store is probably going on their local machine.
  • You really shouldn't be deploying server-class databases to end-user desktops. An in-process db like Sql Server Compact or MS Access is much more appropriate.

However, this logic doesn't quite hold. Even if each of those 4 points is true 90% of the time, by the time you apply all four of them it only applies to ~65% of your audience, which means up to 35% of the express market might legitimately want to talk to a server-class db, and that's a significant group. And so, the simplified (greedy) version:

  • A real db server (and the hardware to run it) costs real money. If you have access to that, you ought to be able to afford at least the standard edition of visual studio.

Connecting to database in Visual Studio Express 2013 for Web

Here are some of the sample connection strings I have described every connection string with full details

For Local Sql server (BuildIn Sql Server Express into Visual Studio).

 For Sql Server instance which comes default with visual studio you can use following connection string  

<connectionStrings>
<add name="ConnectionStringName" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=YourDatabaseName;Integrated Security=True"
providerName="System.Data.SqlClient" />

For Sql Server Which Has been installed seperately such as Evaluation Edition etc

 <connectionStrings>
<add name="ConnectionStringName" connectionString="Data Source=YourPCName-PC\ServerInstanceName;Initial Catalog=YourDatabaseName;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

For CompactEdition of Sql server you can use provider name as

providerName="System.Data.SqlServerCe.4.0"

Connecting Visual Studio 2015 Community to SQL server Express 2016

For anyone else coming across this, I solved the second "Unable to add data connection problem" by following the instructions here

http://answers.flyppdevportal.com/MVC/Post/Thread/0d25df29-0d2b-4b57-8807-392a379c1dc3?category=visualstudiogeneral

Which basically says, do a modify of Visual Studio's installation by adding "Microsoft SQL Server Data Tools"
Then I did a repair installation which highlit a problem with "Microsoft Visual C++ 2015 Redistributable (x64) - 14.something" and the x86 version as they were newer than the ones it was trying to repair to. So I uninstalled them and reran repair. Seems to be working now.

add sql server data connection in visual studio

It looks like this list is opulated based on installed DDEX (Data Designer Extensibility) providers. I am guessing here, but most likely your DDEX providers didn't install correctly or somehow got uninstalled.

Did you try repairing your Visual Studio 2010 installation?

Using data connections in Visual Studio to explore SQL Server Express database

Under server name type in \\\SQLEXPRESS or .\SQLEXPRESS (assuming you have installed the instance with default values)

then you should be able to access the database from the dropdown list.

trouble with initial setup and connection to microsoft sql server from Visual Studio

SQL Server Compact is not a full fledged database service. It is a way to store data in a file and run sql like queries against it.

Here is a short walk through of how to connect to a sql compact database: https://msdn.microsoft.com/en-us/library/gg606540(v=vs.100).aspx

If you want to use an actual sql server you can download and install SQL Server Express for free. Here is a walk through for that: https://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

Both of the linked examples use Entity Framework to connect which is an ORM. There are many ways to connect to a database in C#. But since you mentioned running sql statements directly you may want to look into Dapper.Net which is a mirco ORM that let's you run SQL statements and map the results back to objects.

How to connect sql server express database to VS 2017

Figured out my issue:
in Visual Studio's "Add New Data Source" wizard, the option I kept choosing was "Microsoft SQL Server Database File", because its description is "Use this selection to attach a database file to a local Microsoft SQL Server instance (including Microsoft SQL Express) using the .NET Framework Data Provider for SQL Server."

However, and I'm not sure why, this was not the right selection.

I tried selecting "other" instead.

Then on the next page input ".\SQLExpress" as the Server Name (mentioned on connectionstrings.com/sql-server/ ...Thanks for the lead @ryguy72!)

Then, under "Connect to a database" my local list of databases popped up, including the one I had created already using SSMS.

Test Connection finally worked then!

How to connect Visual Studio 2010 Express C# to SQL Server Express

I figured out a better workaround. The application settings seem to be saved in [Documents and Settings]\[User]\Application\Microsoft\VCSExpress\10.0 and VWDExpress\10.0. What I found is copying ServerExplorer\DefaultView.SEView from the VWDExpress to VCSExpress after creating the connection in WD worked perfectly. I could from there create new objects, refresh from the data, create a database from the design, etc.



Related Topics



Leave a reply



Submit