المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Changing connection string in app.config file at runtime.



C# Programming
06-03-2009, 10:04 AM
Hi,
I need your help for my project. I am new to use Linq To Sql. I have .DBML File and it automatically takes the connection string From SETTING.DESIGNER.CS File or From APP.CONFIG File by changing Application Property of .dbml file to False. But I Want to Provide Connection String at runtime. Because as it is desktop application developed in C# so before installing EXE at client side we are unknown of the server on which the database is attached. The only one solution I have is I have to reopen my application, set the connection string as per user and again make its EXE, this is what i dont want.

Can I pass the connection string at runtime to .dbml file when i run my exe or can i change my app.config connection string at runtime.

.