Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When ready to move a desktop application from developer machine to client machine, do I need to change connection string instance from my machine name to client machine name.Using the setup installer provided by MS.

What I have tried:

tried to change the connection string property before burning copy for client machine. Tried to connect by using clients request to put program on certain drive and file location. does not work get error 26 which seems to be a error number for various errors.error is not able to locate instance.
Posted
Updated 11-Jan-17 6:22am

Here is a breakdown of a typical connection string

Data Source=[name or ip of the db server];
Initial Catalog=[database name];
User ID=[database access uid];
Password=[database pass uid]

If the db is on your machine then you may find issues accessing the database from a remote version of the program. That way lies firewalls and permissions etc...

If you can't access the db via the connection string, make sure you can ping the db server.
 
Share this answer
 
Comments
partimeprogrammer 11-Jan-17 12:46pm    
Thanks for the quick response, the program was built using VS Professional 2015, The database has been added to the project and when checking the files its obviously there.We have pinged the server on the client side and it is there. I have used sql server 12.0.2000. we have also made changes to the firewall and added new rule to allow connection as well as enabling Pipes and TCP/IP.Can not go any further that way as we seem to have used everything available to make the connection viable. connectionString="Data Source=DWAYNES\SQLEXPRESS14;Initial Catalog=********Agri;Integrated Security=True;Encrypt=False;TrustServerCertificate=True"
Should I not be able to change the computer name (DWAYNES) to the Clients Machine Name to make it work. What I had originally was H:/AGRI/PLOTS\SQLEXPRESS14;Initial Catalog=********Agri;Integrated Security=True;Encrypt=False;TrustServerCertificate=True"
First off, you shouldn't have to "burn a copy" specifically for a connection string - that should be in a configuration file so your app does not need to change, and be set at installation time (with a way to change it if the details change in your app) when you check or create the DB for the first time.
The user should know - or be able to find out - what the connection string detail for his instance of SQL Server / MySQL from his DBA, though it is possible to "help" him by locating the SQL server instances:
C#
SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
DataTable dt = instance.GetDataSources();
foreach (System.Data.DataRow row in dt.Rows)
    {
    Console.WriteLine("ServerName = {0}", row["ServerName"]);
    }
You can't - or shouldn't - know the login details for his DB: it includes a password for a reason!
 
Share this answer
 
Comments
partimeprogrammer 11-Jan-17 12:50pm    
in burning a copy, i have used a flash drive to load the program which i then transfer to the clients machine. should have worded it properly to tart with, my apologies.

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



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