Dear senior programmers....
Please help me.I have a c# application.This application include localdatabase .sdf.
This application compiled to setup file.exe.This setup.exe install to other computer then error message show is database path error.Tell me how to write this database path no change and I don't wish install sqlserver to this application installation other computer.
example ..............protable style application.(Like Directory application)Other computer no database server and this application is not change and successfully installation.Please tell me thank.
How to control Database connection in C# Application
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Dharmendra Singh169 pointsPosted Oct 9, 2013, 3:49 AM EDT
add app.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections></configSections>
<connectionStrings>
<add name="JSInventory.Properties.Settings.InventoryConnectionString1" connectionString="Data Source=|DataDirectory|\Inventory.sdf" providerName="Microsoft.SqlServerCe.Client.3.5" />
</connectionStrings>
</configuration>
and use this connection string like
string connection=JSInventory.Properties.Settings.InventoryConnectionString1;