Change BD Sql Compact path in Setting.Designer.Cs C#

Asked

Viewed 32 times

0

I made an application in which the sql file Compact (.sdf) will be allocated on a network PC and I wanted to have the option to change the path of the database whenever I want. For all Datagridview to see this new path, I believe I would have to change the path in the file Settings.Designer.Cs where I have the following line:

[global::System.Configuration.DefaultSettingValueAttribute("Data Source=|DataDirectory|\\Database.sdf")] 

I’m sure?

The problem is that I am trying to put in place of #|Datadirectory| Database.sdf# a "global" variable where you have stored the file path

[global::System.Configuration.DefaultSettingValueAttribute("Data Source='" + globalinfos.bancoDeDados + "'")]

But he gives me the following mistake:

Error 1 An attribute argument must be a Constant Expression, typeof Expression or array Creation Expression of an attribute Parameter type D: HMS PROJECTS 30-05-2017-NEW PHASE - V2 HMS hms hms hms Properties Settings.Designer.Cs 29 68 hms

  • That’s exactly what the mistake says, in that place you can only put an expression constant.

  • Incidentally, because you need to change the path of this file?

No answers

Browser other questions tagged

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