in

System.Data.SQLite

An open-source, enhanced version of the SQLite database engine for Windows

ConnectionString in settings

Last post 09-25-2007 10:01 PM by Wiaz. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-23-2007 10:08 PM

    • Wiaz
    • Top 10 Contributor
    • Joined on 01-11-2007
    • Poland
    • Posts 46

    ConnectionString in settings

    Hi! maybe this question shouldn.t appeer here but.... i'll try :)

    I made dataset and connection string with wizard. It wrote connection string into ....exe.config file. How can I change string in COnnectionString dynamically in my application? I want to give in menu an option to change default database with 'open' menu. Then I only change connection string, save into ...exe.config somehow and that's it. I found ConnectionString in 'projectname.properties.settings.default.ConnectionString' (if I remember it well) but it seems to be readonly:( How can I change ConnectionString in my app to make possibility to switch to another database by user in the menu?

    And now for something comletely different: If i could change that connectionstring in my app than how can I in simply way check new 'opened' database if it has the same schema? before i would use it further in my app. to ensure to work with proper schema database.

    thanx in advance!
    Wiaz
    Filed under:
  • 09-25-2007 5:46 AM In reply to

    • Wiaz
    • Top 10 Contributor
    • Joined on 01-11-2007
    • Poland
    • Posts 46

    Re: ConnectionString in settings

    I found that in every TableAdapter there is InitConnection() that uses global::PROJECTNAME.Properties.Settings.Default.ConnectionString to set ConnectionString Is there some way to change dynamicaly this string and from that moment all Table Adapters are to use this ConnectionString, and more: this connectionString will be saved into ...exe.config file? Maybe some public object: SQLIteConnection type ? When i'm working with wizard then when i change connectionstring within tableadapter in property window then all connections in all datadapters are changing in dataset, why not to give propgrammer such object to change dynamically Connection or only connectionstring? like wizard do? ....or maybe i'm missing something and don't know something? Please answer me, i'm working (nearly finish) my app and want to give possibility to use within the same app different databases (not on the same time:) if it is not possible, please give me piece of advice how to solve that problem: to switch/open another database which i could work on with my app. thanx!
    Wiaz
  • 09-25-2007 7:34 AM In reply to

    Re: ConnectionString in settings

    Answer

    This is really a part of the .NET framework and not a SQLite-thing.  In this case, google is your friend :)

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=821834&SiteID=1

    http://channel9.msdn.com/ShowPost.aspx?PostID=214560

     

  • 09-25-2007 10:01 PM In reply to

    • Wiaz
    • Top 10 Contributor
    • Joined on 01-11-2007
    • Poland
    • Posts 46

    Re: ConnectionString in settings

    Thanks! I didn't know that it is so big problem! Wow!
    Wiaz
Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems