Hello

  I suspect my question may already have been answered many times before, but I 
could not find a way to search through the archives of the sqlite users mailing 
list at: http://sqlite.org:8080/cgi-bin/mailman/private/sqlite-users/. Is there 
a way to search the archives?

  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;
        }
        
Thanks
Manish
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to