Search code examples
c#-4.0setup-deployment

Access database on network


I made a small C# Winform application with a simple GUI and a database (MyDB). Now I want to run my application on the Server. I want other users to access my database through the network. I have a Wired\Wireless network.

Suppose I have 2 systems (sys1, sys2) I have my application in sys1. I created a shortcut of my application in sys1 and tried to run that shortcut. It worked.

But when I am trying to open the shortcut in sys2, it gave me error:

"The drive or network connection that the shortcut 'application.lnk' refers to is unavailable. Make sure the disk is properly inserted or network resource is available, and then try again.".

Then I copied my application.exe.config file near application.lnk.

Do I change anything in ConnectionString? What causes this error?

Note: Application made in C# 4.0, VS 2010.


Solution

  • It sounds like on sys1, application.lnk is pointing to your local copy, such as C:\MyApp\App.exe. When you copy application.lnk over to sys2, it's trying to find a file called C:\MyApp.App.exe on that machine, which doesn't exist.

    You'll have to host your application on a network drive, such as \\MyServer\Apps\App.exe and create a shortcut to that instead. That link should then work on any computer with access to that share.