Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i understand but in my system the connection string is one but in client system the connection string may vary for client to client how it can possible this application will be sucessfully run in client machine
give me some suggestion
Posted

Keep it in your application settings file: MSDN[^]
 
Share this answer
 
Hi,
Add a application Configuration file and put connection string there.
after installation your application,The app.config file remains unchanged and it is editable,You can change conncetion string.
Use Connection string as:

cn.ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"].ToString();


app.config:
<pre lang="xml"><?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <connectionStrings>
      <appSettings>
    <add key="ConnectionString" value="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DealerCare\DealerReports.accdb"/>
    <add key="ClientSettingsProvider.ServiceUri" value="" />
  </appSettings>
</configuration>


 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900