Unable to create SQL Server database from Visual Studio Express 2012 - c#

I'm trying to create a SQL Server database from Visual Studio Database Explorer. When I right click on Data Connections, the Create New SQL Server Database option remains grayed out.
I have VS Express 2012 and SQL Server Express 2012 installed in my system. SQL Server instance is up and running.
Do I need to configure anything, so that Visual Studio recognizes the installed SQL Server instance?

You first need to make a connection to the SQL Server before you can create a database.
Click the Add Connection option and connect to your SQL Server instance, then the option will become available on your connected Server.

Related

Deploy setup program with visual studio and create new instance of SQL Server Express

I want to execute the program that the SQL Server Express database needs to run in the system. I created setup with Visual Studio with prerequisites -> SQL Server Express.
The problem I have is that if SQL Server is another version installed on the system, then I will not install SQL Server 2008 Express; how to create a new instance of SQL Server Express in my setup?

Use visual studio applicaiton that uses SQL LocalDB on a separate computer

I have created a c# visual studio application that uses SQL LocalDB 2016 for its database. Visual studio only allows 2012 to be used as a prerequisite, but I was able to find a 2016 download online. I have tried both SQL LocalDB 2016 and 2017, but get the same error for both.
A network related or instance specific error occurred while establishing a connection to SQL Server. Ther server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. ... error 50...Cannot create an automatic instance.
I have ran sqllocaldb i on cmd and the result was MSSQLLocalDB which is the automatic instance for SQL LocalDB. The connection string in visual studio is set up for MSSQLLocalDB. I have uninstalled all other versions. The only thing I can think of that could be causing a problem is permissions. Thanks

Creating application without SQL Server Management Studio

I created a window application in which I used SQL Server as backend database. But I want to know that is there a way through which we do not need SQL Server Management Studio to be installed on system?
I used Entity Framework with a code-first approach which creates database automatically but needs connection string for that. I need a way through which I can provide connection string of SQL Server Express without installing Management Studio.
You only need to install SQL Server, Management Studio is just for an easier database and server management, but it's not required to make SQL Server services work.
Try using SQL Server Data Tools (SSDT). You can create, manage and deploy SQL Server code right from Visual Studio.
It's built into VS 2013 and up and can be downloaded as an addin all the way down to VS 2010.
https://msdn.microsoft.com/en-us/library/mt204009.aspx

connecting to sql server, problems

I just build my first web-application in asp.net that connects to a local database.
I got a weird problem.
The connection to the database works if i open the website BEFORE sql server after reboot. I can insert/read from the db from my webpage. But then sql server cant connect to the db. It looks like this then:
If i start sql server before the website then sql server works but the webpage doesnt work, visual studio then gives me this error:
Why are they interfering with each other and what can i do about it?
I use visual studio 2010 and sql server 2008 R2.
did you try to open your connection through server explorer from visual studio 2010 ? everytime you want to display the page in an web browser..just make sure you open the database connection through server explorer, it will work...no matter what was the order of your starting sql server.

Can I create and connect to a SQL Server CE database if SQL Server 2005 isn't installed?

Is there any way to do this?
Update: Sorry, I should have included more information. I am trying to create and connect to a SQL CE database using System.Data.SqlServerCe in C# running on a PC (i.e. not running on a Windows Mobile device).
This code:
string connstr = "Data Source=\"" +
filename + "\";Persist Security Info=False;";
System.Data.SqlServerCe.SqlCeEngine engine = new SqlCeEngine(connstr);
engine.CreateDatabase();
... works fine on any PC that has SQL Server 2005 installed, but fails on any PC that doesn't have it installed. I'm trying to find out if there's any way to get this to work without installed SQL Server 2005 on the machine.
You can do it with Visual Studio - when you add a connection, change the data source from Microsoft SQL Server to Microsoft SQL Server Compact 3.5.
Also, if you mean the actual server - as opposed to the management tools - then SQL Server 2008 Management Studio [Express] can open SQL CE databases directly.
Edit: To create the database in Visual Studio, choose "Local Database" when you go to add a new item. That's a SQLCE database. And in SSMS[E], when you choose the SQL Server Compact option, you can choose "New Database" as an option in the Database File drop-down.
Edit2: In order to have code written against SQL CE run successfully on a vanilla target machine, you will need to install something on it, although not SQL Server 2005. SQL CE is a separate product (download page). It should also appear as a redistributable module in Visual Studio if/when you create an MSI installer for your product.
I assume that what you mean is can you create one with a tool, rather than with code. Studio can create them just by going to the Server Explorer and adding a new connection (you'll get the option to create one).
If you're looking for something a little nicer or something that doesn't require Studio, then Primeworks' Data Port Console is a really nice tool.
EDIT
If you need to create it through code then yes, you can still do this without Server installed. Make sure that you have the SQL CE Redistributable binaries (for the proper 32/64bit) deployed to the target and in a place the app can find them.
See locally at
C:\Program Files (x86)\Microsoft SQL
Server Compact Edition\v3.5
or online.
Just to add to what Aaronaught was saying, to connect to a SQL CE database programmaticaly, you don't either need SQL Server installed. CE runs in proc, and as long as the SqlCE dll's are installed (their part of the framework nowadays) then you should be able to connect to it without any issues.

Categories

Resources