-
Jan 29th, 2018, 06:08 AM
#1
Thread Starter
Hyperactive Member
Connection String Issue
Hi there,
I created a small accounting software for my clients using vb.net and SQL server 2014, and i used following connection string, please have a look:
Code:
Public SqlConStr As String = "Server=Server2; Database=DataFileXYZCo; User Id=sa; Password="test123#;"
Conn.ConnectionString = SqlConStr
Conn.Open()
This connection string is working perfectly, the issue is when I make changes for my clients in source files, before copying application file, I have to change the "Server" name in Connection string, as you can see right now its Server2 but on client site its "PTSServer", all 12 customers have different server names. I have 12 clients right now for each client before copying Exe file I have to change the server name and then transfer Exe file.
Is there any way I can create application file and copy to all my 12 customers without changing Server Name?
Please note that I cannot use "local" or "localhost" in server name because application is running on network on each client.
Thanks in advance.
Ladak
Last edited by accmaster; Jan 29th, 2018 at 06:16 AM.
-
Jan 29th, 2018, 06:19 AM
#2
Re: Connection String Issue
We pass the connection string as a parameter to the executable to set the environment. Maybe you can do something like that. Or maybe use an ini file and look up the proper environment from there.
Please remember next time...elections matter!
-
Jan 29th, 2018, 07:05 AM
#3
Re: Connection String Issue
Open the Settings page of the project properties and add a connection string there. You can then access that in code via My.Settings. The connection string you set will be stored in the config file and your users can edit that by hand after deployment, or you can edit it before deployment.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|