In my windows form application, I have placed database with in the project.
But I am not able to write anything into the database. My winforms can read all the contents of the database.
How can I solve this problem?
Currently the database is in the following location:
C:\Users\Amrit\Documents\Visual Studio 2012\Projects\Purchase Management\Purchase Management\Resources\App_Data
In app.config
file I have this configuration:
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="Database" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Resources\App_Data\Database.accdb;Persist Security Info=False;"
providerName="System.Data.OleDb" />
<add name="Purchase_Management.Properties.Settings.DatabaseConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Resources\App_Data\Database.accdb"
providerName="System.Data.OleDb" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
And I am accessing the database from classes using this;
string connString = ConfigurationManager.ConnectionStrings["Database"].ConnectionString;