How to get the connection string dynamically using C#?

I am developing an app in visual studio 2008.

This app should run to any computer where it will be installed. I connect it to SQL 2005 express. SQL 2005 express will also be installed to the same computer where the app will be installed.

How then can I get the connection string dynamically so I can run my app to any computer I want?

Can anyone help me about this? Thanks! :)

2 answers

If you use ".\SQLExpress" as server name it will connect to the local instance.

Will this help? Not sure if I understood your question.

Thanks for the reply.

Anyways, it works!

All I got to do is to truncate ".\SQLExpress" to my connection string.

Thank again! :)