--
   --
      --
         --ô¿ô--
        K e V i N

On Fri, Mar 2, 2012 at 2:47 PM, Agrawal, Manish <magra...@usf.edu> wrote:

>  My question is: what is the simplest way to replace the connection string
> in a C# application with the file location at runtime?      I do want the
> convenience of the table objects that have been auto-generated.
>
>  I am trying to specify the location of a sqlite file in my application at
> runtime. Currently, the dataset is created through the designer as:
>
> DemoDataset ds = new DemoDataSet();
>
>  Browsing through the application, I find that the app.config file has the
> connection string to the sqlite file:
>
> <connectionStrings>
>        <add name="DemoApplication.Properties.Settings.DemoConnectionString"
>            connectionString="data
> source=C:\Users\test\Database\Demo.sqlite"
>            providerName="System.Data.SQLite" />
>    </connectionStrings>
>
>        And the auto-generated DemoDataset.Designer.cs file has a reference
> to the connection string as:
>
> private void InitConnection() {
>            this._connection = new
> global::System.Data.SQLite.SQLiteConnection();
>            this._connection.ConnectionString =
> global::DemoApplication.Properties.Settings.Default.DemoConnectionString;
>        }
>

https://www.google.com/search?num=100&hl=en&site=&q=c%23+sqlite+app.config+%22how+to+change%22+connection+string
 --
   --
      --
         --ô¿ô--
        K e V i N
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to