Problem Related DB

Asked

Viewed 48 times

0

I’m making a system in C#, connected the database (Access) and the program asked to copy the database to the system folder and everything else.

The problem is that the application is not saving the data in the database of the system folder, I have to direct the database in the App.Config.

How do I Do That?

Filing cabinet App.Config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="BancodeDados.Properties.Settings.BancodeDadosConnectionString"
            connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\GlimaSoftDB.mdb"
            providerName="System.Data.OleDb" />
    </connectionStrings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
</configuration>
  • 1

    Can you explain it better? I can’t understand anything.

  • I believe it is enough to remove the part |Datadirectory| da connectionString. Would look like this: Source=GlimaSoftDB.mdb. I understand that in this way it considers the local directory of the executable (if that’s what you refer to as "system folder") as the location of the database file .

  • kkkk. next, in the application I made, when I register a USER for example, in the registration part works normal, but if I close and open the application, the data is not saved in the database. the database is in the "DEBUG" folder of the project.

  • I read about something and saw that the problem may be because the application is not pointed to the database of the folder q the application is, but that has to direct to it through the App.Config, I only know how to do it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.