Creating application without SQL Server Management Studio - c#

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

Related

How can I transfer my local database to another computer which does not have SQL Server Management Studio?

I'm writing a program with using C#. And I'm using SQL Server Management Studio to create local databases to keep my data. I would like to run this program on other computers. I do not want to install SQL Server Management Studio on every computer. Can I move my local database to other computers without installing SQL Server Management Studio?
In example I don't mind installing localDB. Actually I think that I can do it only using localDB but I could not find proper info. My program can reach the database with connections.
In other words, how can I move my database to another computer which ONLY has localDB?
Thanks...
From Microsoft:
LocalDB is a feature of SQL Server Express targeted to developers. It is available on SQL Server 2016 Express with Advanced Services.
LocalDB installation copies a minimal set of files necessary to start the SQL Server Database Engine. Once LocalDB is installed, you can initiate a connection using a special connection string. When connecting, the necessary SQL Server infrastructure is automatically created and started, enabling the application to use the database without complex configuration tasks. Developer Tools can provide developers with a SQL Server Database Engine that lets them write and test Transact-SQL code without having to manage a full server instance of SQL Server.
You can work with LocalDb without having to install Management studio.

Adding SQL Server database to Visual Studio 2013 ASP.Net webpage

I am trying to add a SQL Server database item into my ASP.Net website.
I have SQL Server 2012 installed but when I press add in Visual Studio I get the following error
Connection to SQL server database files (.mdf) require SQL Server 2005 Express or SQL Server 2008 Express to be installed and running on the local computer. The current version of SQL Server Express can be downloaded and at the following at the following URL: "
I am wondering if I can get it to work with 2012 in the way it would with 2005/2008 or will I need to download 2005/2008 to get this feature?
I only ask because it seems a little strange that VS2013 is not not compatible with SQL Server 2012...
PS: I am trying to follow the following tutorial and that is why I am hoping to get this to work so I can follow the tutorial as intended. "http://www.youtube.com/watch?v=Tyr1YXpNOrk"
by SQL Server Management Studio create your database, then in vs 2013 asp.net project use this database into web.config file
in vs 2013 and Server Explorer tab and Data Connections with Add Connection or Create new sql server database use from your db or create new sql 2012 db
I am wondering if i can get it to work with 2012 in the way it would with 2005/2008
What for? To my knowledge that was retired for the bad issues it created.
Visual Studio 2013 comes with an ad job user version of MSSQL (localdb) that is non-install-required and used in case.
Otherwise install the normal sql server and reate the db - do not rely on this functionality (like most non-trivial shops anyway) and no problem arises to start.
Yes It can be done through Visual studio and here is the link to guide A-Z
It will IIS to deploy ASP site.
http://www.asp.net/mvc/tutorials/older-versions/models-(data)/creating-model-classes-with-linq-to-sql-cs
Hope this will work as it worked for me

Is it possible to run an application built on sql server 2008 to run with 2005

I have a .NET 4.0, SQL Server 2008 application built on VS 2010.
Since more than 10 months I have been working on a project and its completed now. I moved to the next task of creating an installation of the software. Its also done. But now I have a big issue.
My clients already run software running SQL Server 2005 and its installed on their system. However when I was packaging my VS2010 C# application, I deployed it with prerequisite of SQL Server 2008 but now the problem is, when I try to install my application, it asks to uninstall the 2005 and then to install 2008. But my clients are very rigid to allow my program to uninstall any application on their system. I am stuck here.
I also tried to remove it from my prerequisites and the application was successful to install itself but after when I tried to run my application, its unable to access the database.
How I can solve this issue? Is there any way to make application and database both work with SQL Server 2005 or 2008. Or maybe any other expert advice.
EDIT 1
I also have Datetime stuff which really annoyed with to accomplish, as my project is multilingual so I have separate functions to handle datetime to insert in SQL.
EDIT 2
Is it possible to upgrade SQL Server 2005 to 2008 using my own Visual Studio Deployment Project?
EDIT 3
This is the error I am getting
Prerequisite check for system component SQL Server 2008 Express failed with the following error message:
SQL Server 2008 Express Service Pack 1 (x64) cannot upgrade the existing instance of SQL Server 2005 Express (x64 WoW) named 'SQLEXPRESS'. Uninstall this instance of SQL Server 2005 Express and retry installing SQL Server 2008 Express Service Pack 1 (x64)."
See the setup log file located at 'C:\Users\BOOGI~1\AppData\Local\Temp\VSD41A1.tmp\install.log' for more information.
EDIT 4 (Main)
Is it possible to make a Microsoft SQL Server database file compatible to run with both SQL Server 2005 and SQL Server 2008?
It is usually not a problem to run an application against any version of SQL Server. Create the database using Management Studio and you're ready to go.
If you have a setup, you may need to change the prerequisites, so that it works with SQL Server 2005.
You may have to adjust the connection string. In the error message you're providing, it is obvious that the instance name of the SQL Server is "SQLEXPRESS", so you need to add this in your connection string.
Also, it is not a problem to run SQL 2005 Express and 2008 Express side by side.
One thing you can do is install SQL 2005 in your development machine or another machine then migrate your schema's and data from SQL Server 2008 to SQL Server 2005 and get your C# application working again. .NET 4.0 doesn't care which version of SQL server you are connecting to as long as you have the appropriate drivers installed for each appropriate database.
For your datetime create a function in SQL server so that it works in both version. Check out some examples in this link.
Thanks,
Kalagen

Modify app.config to connect to a database file in computer with no SQL Server Management Studio installed

I created a software using .net4 which uses ORM and connects to database. So when I need to connect to a file I have to first open SQL Server Management Studio and attach the database to it and then I am able to use my software if I don't do this it throws an exception that the underlying provider failed to open.
Now I want to deploy the software to my brothers computer who doesn't have Visual Basic and SQL Server installed on his computer (but he has the .net framework) so is there a way I can modify my app.config to point to the database file instead and I don't need to attach the file to the SQL Server?
Simply I don't want to attach or detach the file to the database again and again how can the .net automatically attach it.
Indeed, install the SQL Server 2012 Express LocalDB (it is likely already installed with your Visual Studio 2012 installation) and then modify the connection string as follows:
connectionstring="data source=(LocalDB)\v11.0;attachdbfilename=c:\MyDatabaseFile.mdf;integrated security=True;"
the (LocalDB)\v11.0 part is where you point at the LocalDB "instance", and you can attach any mdf file you want. Keep in mind that this locks up the mdf file, so you cannot have it open in Management Studio and run your app.
You mentioned attaching a database, but not wanting to install SQL Server. I would take a look at the SQL Server Express LocalDB. While it is technically installed, it is not installed as a Windows Service, so it is much lighter than full SQL server or SQL Express.

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