Installing a local SQL database on a FTP server - c#

I have created a local SQL database using SQL Server Management Studio. And a program in C# that have a access to that database.
Now I would like to movemy local database to my FTP server. So i could remotely access my database using SSMS and a program that i have created in C#.
My question is, what do i need to do to transfer my database to a FTP server? Is it even possible to have a SQL database on a FTP server, or does it need to be an sql-specific server? Keep in mind that there is no sql managing software installed on a server yet.

Related

How to bake in the databases from SQL Server to C#

I'm very very new to SQL Server, and I have written a program in Visual Studio using C# that uses a table from a database that I have created using SQL Server Management Studio. But if I try to run my program on another device, it either asks for a version of SQL Server to be installed or it fails to connect to the server because I used the local option to create the said database and therefore, the other device doesn't have the permission to connect to it.
I have read somewhere that I should use in-memory databases so that other devices can run this program without connecting to me or needing SQL Server to be installed? Can I store the database somewhere in the project and tell my program to seek it and load it?
TLDR; how to use the features of SQL Server like database and tables while offline and without the need to connect to any server or even the need to install SQL Server itself if possible.
And sorry for my bad English!

Database application using SQL Server 2008 or any dbms

I'm developing a database application using SQL Server 2008. Since I finished my project and I thought I should see it working on another PC or friend. There is a problem in the database server it wants to connect. I want my app connects to the SQL Server every time it runs on a PC of mine, or any other's without losing any data.
I'm using Microsoft SQL Server 2008 installed. I want to use my app other pc without installing Microsft SQL Server.
If you want to make your database 'portable' you have a few options:
Use a online database service, like Microsoft Azure. You can have one central database which you can use with an internet connection;
Save the database next to the application, something like 'embedded', you can use LocalDB for that. Make sure you copy the database file along with the application.
When you want to run your application on another pc, one way is updating connectionString of DB.

Can we connect two projects to the same SQL Server Express database?

I am facing a very weird situation where by my company wants me to use SQL Server Express. But the issue is I need to use the same SQL Server Express database for connection by different projects.
How do I do that?
I am using Entity Framework and C#.
You'll need to copy your .mdf from your App_Data folder into SQL Server Express's data folder, attach the database to your Express instance, and then change your connection string to reference the instance instead of the location of the .mdf.
This answer to a similar question gives detailed, step-by-step instructions for this process.
It seems you are trying to attach local database file with AttachDbFilename= option in the connection string. But you can't simultaneously attach the same .mdf on a local drive with several concurrent applications (like you can do with MS Access).
Rather just install SQL Server Express on a central computer and open it up for remote TCIP/IP access, attach your database to it and change the connection string to an IP / instance one.

SQL Server database or database on SQL Server

I'm writing windows application which will be used on one computer. I like to do with SQL server, retrieve data with stored procedures, and so...
My question is, what is the difference between SQL server database (in file) and standard db on SQL server, because I don't want to install SQL server on client's PC just for one app. Can be this SQL server DB used with stored procedures, or is there other way?
Thanks.
If you don't want to install a full SQL Server engine on the client machine you could use an embedded database such as SQL Server Compact or SQLite which are designed for those scenarios.
You may want to look at SQL Server Compact, SQL Server Express or something like SQLite. I don't think any of these really offers a way to run a database engine without installing something or requiring something else to be installed (e.g. you could use AttachDbFileName method with SQL Server but this relies on VS/Express to already be there).

c# Connecting to a local MDF DB File

On my development computer I have MS SQL Server/Visual Studio 2005. My program can correctly connect to my local DB and use it. However my other computer (non-dev) does not have MS SQL Server/Visual Studio 2005 and does not connect to the DB. It spits out the following:
"An error has occurrred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. ..." (Error: 26).
Does this mean I have to install SQL Server 2005 on my non-dev computers? Is there any other way?
My connection string is:
"Data Source=.\SQLEXPRESS;AttachDbFilename=\""
+ Directory.GetCurrentDirectory()
+ "\DB.mdf\";Integrated Security=True;User Instance=True";
Your connection string is telling the Sql Server Native Client ADO.NET Provider to attempt to connect to a Sql Server instance named SQLEXPRESS that will manage the database stored in a file DB.mdf. Since your client computer does not have Sql Server Express installed, it's not going to find a database to connect to.
You will need to:
Install Sql Server on the client computer and deploy your database there.
Switch to Sql Server Compact Edition (SqlCE - embedded database) and re-architect your application to use the portable database file (with SqlCE) instead.
Ditch using a robust database engine and switch entirely to ADO.NET DataSets, saving/loading the contents of the DataSet to an Xml file (via WriteXml() and ReadXml()). If the amount of data you are processing is fairly limited in size, DataSets are a good approach to maintaining integrity (via a strongly typed and well-defined schema) and portability.
If you want to run it on that other pc/server you also need to have SQL Server (need to attach your .mdf to it) or SQL Server Express installed.
Another trick would be to change your connection string so that it points out to another pc/server where your database runs on.
Yes, you do need MS-SQL (Express) available on your target computers. Either a local install or a connection to a server.
It is not that difficult to include SQl Express in a Setup.exe (see PreRequisites).
An alternative is to use SQL-CE or Sqlite or (even) MS-Access. They are 'embedded' database engines so that you only need to distribute DLLs.

Categories

Resources