none
Format for "connection string" type in settings file? RRS feed

  • Question

  • I'm currently setting a connection string to my database in code, and would like instead to shift this into the settings file. This is what I'm doing at the moment:


    Code Snippet

    string ConString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
                                    MyProject.Properties.Config.Default.DBpath + "\\" +
                                    MyProject.Properties.Config.Default.DBuser ;

    OleDbConnection conn = new OleDbConnection(ConString);


    where MyProject.Properties.Config.Default.DBpath is the file path and MyProject.Properties.Config.Default.DBuser  is the file name, already set up in the settings file. What I'd like to use is something along the lines of:


    Code Snippet

    string ConString = MyProject.Properties.Config.Default.DBconnectionstring;
    OleDbConnection conn = new OleDbConnection(ConString);



    but I can't seem to get the format of the string right in the settings file. Can anybody tell me what I should enter for the value of MyProject.Properties.Config.Default.DBconnectionstring ?
    Friday, September 21, 2007 5:32 AM