What I have to have for running sqlserver? - c#

I have a simple code that is using C# and Sqlserver 2008.
For my C# code I get the .EXE file to customer and forced to install the .NET framework on her computer to run just the C# code.
But about the Sqlserver; I have installed the complete Sqlserver on my PC then attached my database on management part of that and am using the Sqlserver
now that I want to get my program to customer I install the .NET framework; but how can I run Sqlserver on her computer and attach the database each time?
Lets me to explain more:
The program will use on a local network and is multi_user.
I installed and am using the Sqlserver on my PC. I created my database and it's tables by help of sqlserver management tool.
for connecting to the datatbase I wrote a code that connect via the users IP address and I tested it on my PC with 2 Virtual machine. It is working truely.
My problem is here:
When I get the program to customer, what I have to do exactly?
What about the database I have to do?
I have to install the whole Sqlserver on customer PC and set that PC as a server or I have a better way to do this?
Thanks.

If you want to use sql server as an embedded database for local storage, use sql server CE.
If you want your users to have access to a shared database you'll have to instal sql server (sql server express may do) on some machine in their network, configure the access rights, and adjust their connection strings accordingly. Or use SQL Azure.

I have to install the whole Sqlserver on customer PC and set that PC
as a server or I have a better way to do this?
yes you have todo all this work
1)install sql server and the management
2)install your database
3)remote your database to be used

Related

Using C# application with Mysql Database on Another Computer

I have made a C# application MySql Database attached I am going to use the Application on a different Computer. According to my Logic. The Mysql database is running on the localhost server of my first PC and I think that the localhost of the other PC will be different. So,My application Won't connect to the server - It's my Idea which may be wrong.
I have the following Questions :-
1.
How do I make a Mysql local server that will even work on another PC.
2.
Do I have to Install MySql on other PC ? If yes How can i include mysql setup in the Setup Wizard of my app.
3.
Do I have to make changes In the Code (Connection or anything).
Please Give any extra suggestion if you have about this.
You do not need to install mySQL on the computer that will have the app. that defeats the purpose of having a SQL Server
You will only need to change the connection string so instead of connecting to Localhost or 127.0.0.1 you will use the ip address of the machine that has the server installed. Connection Strings
I suggest you do some reading about networking, design patterns, and SQL or you risk building a very insecure application.

C# connect to MSSQL .mdf DB without Server

How can I ran x86 .net 3.5 Windows Forms app with .mdf database on the computer without SQL Server (for example, XP of common user).
I have found few samples of connection strings, but all of them are contains something like Data Source=.\SQLEXPRESS
Doubt, that user will be having SQLEXPRESS on his computer. I want something like work with Access db - so user could work without even knowing, what's server, only with local file
MSSQL I have chosen instead of Access, because in the future I can add publish DB on server, but not now.
Maybe, I should use SQLLite, but how in that case?
Thanks.
How can I ran x86 .net 3.5 Windows Forms app with .mdf database on the computer without SQL Server?
This question has very simple answer - you can't!
You must distribute and install some version/edition of SQL Server with your application, otherwise the .mdf file will be nothing more than waste of disk space. You can install SQL Server along with your app. For more information you can see Install SQL Server from the Command Prompt and Install SQL Server using a configuration file. If this is a simple app working locally on a single workstation, you may want to consider using SQL Server Express LocalDB.
Another option is to use different database engine, which has easier deployment and embedding - SQLite, Firebird Embedded, etc. Pick one that you like. Most of these solutions require only to distribute one DLL/assembly with your application. You will not get the full power of SQL Server, but for most apps, it isn't needed anyway.

C# SQL Server: Application works with database from another pc

I have my application written in C#, it uses a SQL Server database. I have a connection to a database in my C# code, some queries to write/read from database.
Now consider following: if I want to run this app from another PC, this PC has no SQL Server, will this app work? (I assume not) If not then how can this another PC still work with database? Is there a way to programmatically create database on another PC using C# so it has a name I need, columns I need. I created my database using SQL Server Management Studio.
I guess your application works with a local server.
First of all you should check in your application at startup if there is any local mssql server running. If not, you should handle it by installing one programmatically.
Read this answer how to do this if you don't know it.
After that you have to create the database, it's tables, maybe adding user priviliges. Write a SQL script that gets started by a class that starts it.
Read this to see how to start a SQL script in C#
You can do this by setting up SQL server on another machine (server).
Set that servers authentication to SQL Server authentication (requires username and password for that SQL server Management Studio)
Change the connection string in web/App.config from your C# app to use that servers Ip address and Credentails for SQL server

How can I run an application that depends on a SQL database on another machine with SQL Server?

I have created a CRUD application that is running really well. It connects to SQL on the same machine. I want to publish my C# app and install it on another PC does not have SQL.
Is it possible to run it on that PC, without installing SQL Server on it? If so, how do I do this?
Is it possible to run it on that PC?
Without a database your application is "dead".
You have two options.
Install a sql server it this PC.
Connect to a sql server isntalled in another PC.
It's your choice.
If your project is a small one and the database is less than 4GB and you are not going to install SQL Server on every machine and your client do not have access to a Server with SQL Server then you may want to use SQL Server compact
In this case your database would be an single sdf file and you will connect to it using its path on the machine. Then the connection string would be like this:
Data Source=MyData.sdf;Max Database Size=256;Persist Security Info=False;
For more on connection string see this.
Here is the download link

Connecting to sql server database mdf file without installing sql server on client machine?

I am creating a window application that need to use sql server database.
I want to install this application to client machine without installing sql server so that my application can still connect to a database i.e mdf file that i will be providing at client system.
How can i connect to a database(mdf) on client machine through my window application without installing sql server. ?
I dont know is it possible or not.
If possible what will be the connection string in that case. Database need not be used in network.
Client mahine dont need any installation. Every thing needs to be run through pen drive
.mdf files are SQL Server database files. No other application can understand, read or update those files. If you need to open and mdf, you need a SQL instance. That instance can be local, can be an Express edition, or can be a remote one, doesn't matter. If your application needs a local SQL instance for it's own use then it can install SQL Server Express Edition when deployed.
You can try Sql Compact Edition or SqlLite. I think these are just a file based solution.
In that case you must have a server machine where your database files are stored. For that reason you have to use SQL Express Edition 2005 or 2008 in one machine and SQL server management studio to manage your database. Those are all free from Microsoft. The client machines will be connected through the connection string. Those machines don't need SQL instance or SQL server installed.
Regards..
You can search your MS-VS CD for SQLEXPRESS (please note the capital letters) and include it in your software when you create the set-up and your problem will be solved.
You don't have any other way except to use another database like access.
This database doesn't need its software.

Categories