Transferring winforms app with local db to other computers - c#

I have built an app with winforms application and added a local database to my project using based-data source.
on the app load event the app connects to the database and loads its components accordingly.
everything works fine on my pc but the problem is when I am transferring the app to other computers. I am getting an error every time the app tries to connect to the database (local Database Run time error occurred).
Tried to install SQL Express localdb 12 on the other computers and checked that the service: SQL Server VSS Writer is running but still getting the same error.
Note: the database.mdf file exists in the same location on all the computers.
SQL Error:
How can I fix it?

I suggest not to hard-code connection string in code. Move connection string in configuration file and access from their and rebuild your application. Now when you move your project to other computer, you move configuration file which is generated by build as well. On new computer, open DB and freshly copy your connection string and replace it in your configuration file and then run your application. Hope this will help.

Related

C# database error while running application on Clients Computer

I have created a project and so far in that project I am using localdb to create a database, reading a CSV file from a shared drive.
I have copied a .exe file from bin\Debug and copied that onto the client's computer. I am getting the following error, can someone please help:
[
Is it because my client does not have sqlserver or localdb installed?
I need to create an application without requiring any setup to be installed at client machine.
Please let me know if it is possible. Thanks

Run application in client machine using SQL database from another PC

I developed an application in C# and SQL and now I want to run it on another client machine without creating an installer.
I want to use the EXE from the Bin folder which is autogenerated when we run application in VS 2012. But it's not getting the SQL connection to the database on the other system.
it should work as is, make sure that you have access to the database from the second machine (network and permissions).

DO I need to setup sql server in a computer to run c# desktop application file made in vs 10?

I have a desktop application made in vs 10 with sql server 8. I have added the mdf file in app_code folder of project and the app.config is changed accordingly.The application is published and is availabel as setup file(.exe).If i want to install it in another pc, do i need to install the sql server in that pc?
The short answer is Yes
The idea is database needs a server to host it and an engine to run it
mdf file has no value without sql serve and access files has nothing to do if you don't have MS Access installed, etc.
But this does not mean db server must be installed on the client machine that has the application. as it can be on another machine or on the cloud (i.e. hosted on the internet)
As long as your application is connecting to that machine/server

.Net Application Installation 2012 with database

I have built a Windows Forms application using Visual Studio 2012 and MSSQL 2008. I need to deploy this project using InstallShield Limited Edition.
While running this application on my pc, it does nto work well when I use the following connection string or .//SQLEXPRESS.
I need the installer to find the exe file of the application on other uer's pc with the database file. Where do I need to put my database files in the deployment files folder? What should my connection string be?
i use .//SQLEXPRESS it doesnt work as well
DO NOT use .//SQLEXPRESS as datasource name in the connection string.
Recommended way is to menthion Instance Name if your application is to be deployed in different environments(especially OS). I ran into trouble when I had the Datasource as .dot which worked in Win 7 not in WinXP. Either one of the following approach works fine.
(local)\SqlInstanceName
(ComputerName)\SqlInstanceName Ex: CD-SJHONES\SQLINSTNACE
In certain cases i had to include the computer name, So during the application deployment i get the computer name and update the connection string accordingly.
where i need to put my database files in deployment files and folder
and what should be my connection string
Connection string
I have already answered connection string releated question above.
Database files
What do you mean by database file. how database is created in the client machine ? do you create a database during application deployment or users manually create it with script ? There is nothing to worry about the database fine as long as your application have right connection string to point to your database.
Application files and folders
Again this doesn't really matter where application files and folders resides in the client machine. It's upto the users to decide where he/she likes to install the application.
You cannot install from backup. Also in your scenario, you should force end user t install Sql Express, what If it has already installed. So You need considering , scripting of entire database. You can create another exe / look for option in Installshield to execute that Script incase the database server is found else, force user to download the Sql Sever Express or Embedd it into setup and execute the script over there. But that will make your Setup Size more than 100's of MB.

appharbor connection string

I'm building an ASP.NET MVC3 application that requires access to a database. I've successfully set up the database on my local machine and everything works fine but then I uploaded the app to appharbor.com for testing and now I can't access the database anymore.
How do you add a connection string for a SQLEXPRESS database on appharbor.com? The database file is in located in the App_Data folder. I've been trying for days to make it work without avail. I already added the SQL Server add-on on appharbor. I'm not using any Entity Framework features if it helps to know.
You shouldn't use application-embedded SQL Server express databases when running on AppHarbor. Whenever a new application version is deployed, any filesystem state is lost and you'll loose any changes to your database. Check out this guide on how to use the Sequelizer add-on: http://support.appharbor.com/kb/add-ons/using-sequelizer

Categories

Resources