C# database error while running application on Clients Computer - c#

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

Related

Deploying c# console application on server without actually installing oracle client

I have a c# console application which is scheduled to import bulk data from oracle to sql database. I am leaning towards using the oracle client dlls from the installation folder instead of having it installed on server. I read many existing SO answers on copying required dlls in installation folder.
https://jeremybranham.wordpress.com/2011/04/25/oracle-instant-client-with-odp-net/
The application works fine on my windows 10 machine where no oracle client is installed. But on Windows Server 2008 R2 it throws error saying OraOps12.dll is not found. Though I have the dll available. What can I do to troubleshoot the issue?
Make sure the dll is referenced in the project and it's set to copy to the output directory. I can't explain why, but I have had referenced dll's not set to copy and have run into similar issues as you are describing.
I think it is a bad idea to copy the DLL's from the Oracle Client manually. You may provide a copy of Oracle.DataAccess.dll - for all the rest ask your customer to install an appropriate Oracle Client, i.e. the version and architecture has to match the Oracle.DataAccess.dll.
Or use the ODP.NET Managed Driver (Oracle.ManagedDataAccess.dll), this is a stand-alone DLL which does not require any additional file.
Finally I could work it out without actually installing Oracle Client on the server. I was receiving error about not able to load OraOps12.dll but eventually I found out that the dll I was missing was msvcr120.dll. The dll is Microsoft Visual C++ Runtime. So now, I have following Oracle dlls in my deployment folder & the application is working. No changes in configuration are required.
msvcr120.dll
Oracle.DataAccess.dll
OraOps12.dll
oraociei12.dll
oraons.dll
oci.dll

Transferring winforms app with local db to other computers

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.

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

Cannot access SQL Server CE DB after installation

I have created a Winforms app that writes all data to a SQL Server CE database. I am able to successfully install the app but when I try to read or write data, it tells me that it cannot open the connection. This only happens on PC's other than the one I created the program on. Nothing is hardcoded.
Does anyone have any suggestions?
Thank you
Windows will fight you with permission issues for locating the database in the Program Files directory. It doesn't belong there.
Consider moving the database to your own folder in this root folder:
Environment.SpecialFolder.ApplicationData
Obviously, the connection string needs to reflect that folder path.

.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.

Categories

Resources