Click here to Skip to main content
15,938,218 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello all.

I’ve written a program using C# and LINQ to SQL in VS.Net 2015 on windows server 2012 (Both C# and SQL Server have been installed on the same windows, and this system is a Domain Controller).
The program is running precisely.

But when I share the EXE file which is in Debug directory on clients, the database is not able to be recognized.

Can you help me?

What I have tried:

I have no problem with my codes.
Updated 4-Mar-19 6:50am
Richard MacCutchan 4-Mar-19 10:30am    
You need to provide more details. We cannot guess what your code is doing. Incidentally, it is generally not a good idea to install Debug versions on your clients' systems, install the Release version.
Pouria Polouk 4-Mar-19 13:00pm    
Thank you

Probably, it's down to your connection string: you are likely - for development - to be using a local installation of SQL and connecting to it via "localhost" and using integrated security.
That's not correct for production: they need a centralized SQL Server instance, and "proper" username / password combos which give them just enough permission to do their job, no more.
And that means they need a different connection string - they should never be sharing the SQL server instance you use for dev as there is far, far too great a change of your code modifications damaging production data.

Hopefully, you have written your code without "hard coded" connection strings and it's just a case of changing your config files to reflect the new info

Here's how I do it: Instance Storage - A Simple Way to Share Configuration Data among Applications[^]
Share this answer
Pouria Polouk 4-Mar-19 13:00pm    
Thank you, I'll consider your solution
In addition, if you've built your application to connect to and interact with a database, I suspect there might also be dependency libraries associated with it (could be *.dll in your output directory.) If you don't also copy these across your application will not be able to load the required runtime types to run properly.

Also make sure that the client computer has a valid version of the .NET framework which will support your application. Not all computers immediately have all the required runtimes needed, especially those which connect to databases which might require ODBC connectors setting up, etc.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900