C# Winforms - How to run exe file in other system - c#

How to run exe file of C# Winforms app in other system or my client system?
In that Winforms application I have used SQL Server 2005 & C# for frontend ....
Now can anyone tell me, for that Winforms apps, remote connections is necessary or not? If yes then how to work on that, so I can easily run the exe file on other system also ?
I have done exe part but that file runs only on my system & that not runs on other system .

Just publish your .exe using Click Once and add all the required Prerequites.
About Sql Server you have to install that on your client system and attach your database.
Goto Project Properties
Click on Publish Tab
Press Prerequisites and select all you need for your application to run like .Net Framework...
Click on the Publish Now Button

If you are trying to access an SQL database from another machine you will need to make sure remote connections are enabled, firewall has the right exceptions in it and the connection string points to the servers full computer name/ip address.
EDIT
How to enable remote connections SQL server 2005
SQL server 2005 connection strings
Connect to database using sql server remotely

Related

How can I Install C# desktop app with SQL Server database on client machine without installing SQL Server

I have a desktop app developed in C# with SQL Server and I want to deploy the app on client Machine.
How to compile the app into setup files?
I have SQL Server Express installed on client machine.
When you compile the app you will need to have the connection string to the database that exist on the client machine. Also ensure the correct tables and what not are in there too. You can compile the app for release by right clicking the solution and then clicking publish. You can then publish a release version for production that can be used on client machines.
You will have to do this for every client machine.
Some options to make this easier might be as follows:
Create a shared instance of SQL Server that all clients can connect to
Use a nosql solution like litedb or something else.
Store the data locally in another fashion.
Hope this helps! Leave comments if you are confused on anything.

How to transfer the local database of wpf application from one computer to other?

I have created a local database in my WPF application,now i want to run the application on some other computer,now how to transfer the local database from one computer to other,and i dont want to create the database manually on other machine? Do we have to convert the database into some .exe file ? If yes,then how to do this or what is the best approach to implement this?
My application accesses its own database file in its own directory with this connection string:
System.Environment.CurrentDirectory + #"\Data\" + databaseFileName;
Please explain from scratch as i am new to this??
I suppose you're running your database in SQL Express. You can use SQL Server Management Studio (included in most SQL Server installers) to export your database, including data, to a .bacpac file.
In SQL Server Management Studio 2012, right click your database, select Tasks, then Export Data-tier Application... and go through the wizard.
Then connect SQL Server Management Studio to the SQL Express server of the target machine. You can do that by connecting Management Studio on your machine to the SQL Express running on the target machine (provided that a network connection exists between the two, and the target machine has been properly configured to accept the connection), or by also installing Management Studio on the target machine, then connecting it to the local server (.\sqlexpress).
Once connected, right click the Databases in the Object Explorer, select Import Data-tier application..., and go through the wizard.

Deploying Windowsform application with SqlServer 2012 Databse in Visual Studio 2012

How can I deploy a windows form application with sql server database. I've searched a lot, The problem is I want the actual .mdf file when the application got installed on a PC for backup purposes. When I tried the publish feature, it converts the .mdf file into .mdf.deploy. I don't want to attach it into Sql Server Management Studio. I want to publish it with the actual application as .mdf, Kindly guide me in right direction. Thanks
If you nose around on the MS SQL Server site, you find that you can include a 'silent installer' for SQL Server in your .NET project. This will download and install an instance of SQL Server Express as part of your installation process. Just having the .MDF in a folder is useless.
In effect, you have to make at least a few items of functionality that stand in for SSMS: in particular database backups, database compaction, DBCC CHECKDB, etc. You are installing a 'full blown' SQL server instance, with it's separate windows service and system account, so you should be aware of how that impacts your user machine. This gets interesting if it's being deployed to a laptop, particularly a laptop that might sit in a café exposing ports to public LANs.
In general this is a can of worms. It is better to mandate the installation of SQL Server Express first, with SSMS, and merely attach your database to the existing instance. This makes a lot of other operations better behaved.

How to add .mdf file to create .exe setup file in C# windows application

I created a C# windows application with sql server, 2008 database as backend. I would like to deploy the project along with .mdf file so as enable on client computer to create a database folder when the project is installed on it.
Client computers wouldn't have SQL Server installed (that's what's on the server). It doesn't make sense to deploy the MDF file.
Besides, Deployment/Setup projects do not come with a step that attaches a database file to a server. I wouldn't recommend distributing a database in binary form anyway - if it's a new application I would run a setup SQL script from within my application, this means that your application will work against a variety of SQL Server versions (as MDF files are not necessarily transferrable between SQL Server versions without some massaging).

programmatically restart sql server is win7

I have vs2010 click once winform program that performs the setup for another program. This setup program makes sure that they sql server is installed, creates the database/logins/tables, enables mixed mode, restarts the sql server(2008 express) then adds the stored procedures using the login and preloads some tables to get started. Works fine for winXP. When i do the setup on a Windows 7, it fails when it tries to restart the server.
I'm guessing it's a win 7 UAC 'feature' that prevents it, when I manually restart the server I get a UAC alert. I'm currently using the 'stopService' and 'startService' functions from http://www.csharp-examples.net/restart-windows-service/
Is there another way to do this in code without me having to install the SSMS to manually restart in Windows 7?
Have you tried running a prepared .bat file that restarts the sql instance via:
net stop mssqlserver
net start mssqlserver

Categories