When I run my C# application on another PC, a network-related error appears. On my PC, it runs fine. I have used AttachDbFilename=|DataDirectory| to specify the location of my .mdf files. Now, what am I missing in this deployment that makes the application not to run on other PCs?
You are missing an SQL Server instance on your client machines,one option is to install LocalDB on them. Find the installation file SqlLocalDB.MSI, suitable for OS versions on your client machines, you may try this latest version https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SqlLocalDB.msi
Related
I’ve created a C# application and have published it. I tested the published application on my own computer and everything was working properly. When I installed the app on my client’s computer that has the same SQL Server version installed as mine, when I want to open the app, I get this error:
Can’t use or open database because it’s version 852
and this machine supports 706 or earlier.
I’ve installed SSMS, SQL Server Express, a higher version (2017) of SQL Server, but none of the above helped. I’m frustrated, what can I do?
My App.Config file is like this:
Data Source=(LocalDB)\MSSQLLOCALDB;AttachDbFileName=|DataDirectory|\SLApp.mdf;Integrated Security=True;
Everything works fine on my computer with the config mentioned above. Now what can I do?
Everything works fine on the computer that I built the application on, both the database and the program were created in vs2017. When I install the application on another computer that has sql but not vs installed, it gives me 'error 52 a network related issue has occurred unable to connect to local database.' How am I supposed to get it to see the database on another users computer other than my own? I was able to successfully get my app to work on a different computer that has vs and sql installed, but I dont want to install 50GB worth of excess on every computer.
Below is my connection string
<add name="ExagridEntities" connectionString="data source=(LocalDB)\MSSQLLocalDB;AttachDBFilename=|DataDirectory|Exagrid.mdf;" providerName="System.Data.EntityClient" />
I have tried publishing from visual studio by clicking project>publish and also creating a setup project where I put the mdf file in with the application files but they both returned the same error 52.
UPDATE
When I installed visual studio on one of the computers my program ran just fine. Does anyone know what package I need so I can just run the program without having to install vs?
I'm trying to learn how to create a simple application using Visual Studio IDE in C#.
I wrote a little application that uses a local SQL Server database for reading and storing data. On my machine, the program seems to work normally, but when trying to install the application on client computer it seems unable to read from the database.
I've tried to include the following prerequisites to the publish properties but it doesn't work:
Microsoft .NET Framework 4.5.2
SQL Server 2012 Express LocalDB
Any ideas about the right way to do it?
Thanks to all.
You need to install SQL Server Express LocalDB (SqlLocalDB.MSI) on the computer you are deploying your ClickOnce application to.
Selecting "SQL Server Express LocalDB" in the Prerequisites window and using "Download prerequisites from the component vendor's web site" should take care of that:
If you do that it should install the LocalDB for you and any database errors are more than likely resulting from connection string errors or leaving Integrated Security enabled.
You need to test on a target computer which does not have "SQL Server Express LocalDB" installed and verify that after the ClickOnce deployment it is installed. This will confirm that the problem is not the missing prerequisites but the database access issues...
I am developing a Windows application that connects to Oracle DB.
The machine I am developing the application on has Oracle 6i installed with SQLPlus and Toad to access Oracle by command or graphical interface.
The same set up is true across all other computers in my work place.
The only difference is that my pc has Visual Studio and Oracle 10g ODP.Net libraries to make the development of Oracle Application possible using Visual Studio.
I made sure to include Oracle.DataAccess.dll file along with the EXE in the same path to reduce dependency on default paths/ etc.
The finished EXE file runs as expected on my computer, but whenever I publish it to the other computers, I get the following error message:
The type intializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.
I tried to change the version of Oracle.DataAccess.dll from 2.111.6.20 to 10.2.0.100.
Again, it ran perfectly on my PC but gave the following exception on other PCs:
Unable to load DLL 'OraOps10.dll': the specified module could not be found.
I copied the said file above from my pc and included it in the published folder of the EXE but the same error message appeared, as if it invisible to the .Net application.
All computers have Windows 7 and all of them are 32bit.
Is there a way to make the application connect to Oracle regardless of the libraries or Oracle version installed locally on the computer? (The same way Toad works whether it detects Oracle 6i or 10g installed)?
I can't install the Oracle 10g ODP.Net libraries on all computers.
I am ready to finalize a winforms add in I have created for Excel which uses Add-In Express to publish.
This add in uses a sql server localdb database with mdf file.
My primary question is how to deploy the mdf file to target machines. So far, I have manually copied the mdf file to test machine, but when testing the add in it fails to connect to the file (localdb is installed).
Error message:
Exception Source: .Net SqlClient Data Provider
Exception Type: System.Data.SqlClient.SqlException
Exception Message: Cannot open database "MyDatabase" requested by the login. The login failed.
Is it even possible to just drop the mdf onto machine and everything work? If so, is there a guide somewhere that could help. Or do I have to generate the sql scripts to create the database locally? If I do have to generate the SQL scripts, is there a way to roll this up in the Click-Once deployment approach, or I do I need a seperate process?
This is how you deploy a WinForms application with LocalDB
You have to create a localDB on your application and make sure the application will connect to that localDB.(if you don't know how to connect to local db, here => Connect to LocalDB. And make sure to create tables and procedures as same as your previous database.
Follow this answer(ticked) with code(connection string)
After this, you have to install Advanced Installer to create an installer for your application (the best choice I ever chose).
Then Follow this to create an installer where you make sure to add a prerequisite of localDB (say localdb 2019) installer of your current version.
This makes your application run on any pc and only requires localdb as a prerequisite to be installed which also comes with the installer.
Make sure to leave a message not to delete localdb on the application installed location.