Ahad aghapour
Ahad aghapour

Reputation: 2553

App.config.exe connectionstring tricks

I'm trying to develop multi client in C# with SQL Server 2008 data Base, after made setup file and install it to client I cannot access DataBase in server. I used LINQ to Connect DataBase and have App.config xml file in my project which ConnectionString Declare there and I after installing the application I change that XML file's ConnectionString to right way(Server name and sql instance name), but this change doesn't have any impact, whats the problem maybe have my solution? If any one has experience about developing multi client application share with me. and also How can I change scope in project properties from Application to User, It's may be solve my problem

Thank you

Upvotes: 1

Views: 477

Answers (3)

Ahad aghapour
Ahad aghapour

Reputation: 2553

In this project we use LINQ to connect Database to server, and we can get right Database address dynamically from User Interface and use it in constructor of DataContext:

public DataClasses1DataContext(string connection)

And then it don't care in embed connection string, its use only that connectionString in their constructor.

Upvotes: 2

KnarfaLingus
KnarfaLingus

Reputation: 466

If the error mentions "provider: Named Pipes Provider", then your application is trying to connect via named pipes to your SQL Server, is that what you want? You can prefix the server name with tcp: to force TCP/IP usage instead i.e. Server=tcp:ServerName if you wish to use TCP.

If you want to use named pipes it is possible that support for it is turned off on the server, I believe it is disabled by default. You would need to enable it via the SQL Server configuration manager program on the server, in the network configuration, protocols section.

Upvotes: 1

hagensoft
hagensoft

Reputation: 1507

hmmm, hard to say without the connection strings or error message, but some ideas....

When you change the app.config, restart app to verify changes. Try pinging the server from the where the app is being installed. Check firewall settings. shared network. Use your new connection string on your development machine on the same network if local.

Upvotes: 0

Related Questions