By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,569 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,569 IT Pros & Developers. It's quick & easy.

Connection String

100+
P: 107
Expand|Select|Wrap|Line Numbers
  1. Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\POS.mdb"
Expand|Select|Wrap|Line Numbers
  1. Connection.ConnectionString = "DSN=db"
Hi experts, i don't understand how to make our connection string dynamic. With it i mean, only the second method above (with use of DSN) i can do that. Whereas, in the first method i have to hardcode the connection string which i don't want to do. I would want to setup a connection string such that whatever the database may be, when i install the application i should have flexibility to define the connection.
Example:
Expand|Select|Wrap|Line Numbers
  1. "Provider=" + providername + ";Data Source=" + datasource + ";Username=" + username + ";Password=" + password
HOW CAN I ACHIEVE THIS??? WHAT IS THE STANDARD METHOD FOLLOWED TO ACHIEVE THIS???
Aug 7 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.