Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6024837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:12:49+00:00 2026-05-23T04:12:49+00:00

I added a MS Access file into a project and VS created me a

  • 0

I added a MS Access file into a project and VS created me a DataSet. I was very happy with that, but now I’ve a small problem:

I want to have the connection string in the app.config file, to allow customer to edit it. I go to the app.config file and I saw this connection String, “GREAT” I thought.

But it seems that this is not used. I found that the connectionString which is used is contained into the Settings.settings file, which I cannot edit at run-time.

Any idea how to resolve this? I even can specify myself the connection string programmatically if needed, but I didn’t find how to specify this.

Thank you very much!

EDIT: Here a some code:

One example of the generated code which seems to refer to the Settings.settings file:

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
        private void InitConnection() {
            this._connection = new global::System.Data.OleDb.OleDbConnection();
            this._connection.ConnectionString = global::Infoteam.CliniqueLaSource.DocuShare.Communication.DatabaseAccess.Properties.Settings.Default.ClsConnectionString;
        }

What I’ve in my app.config file:

 <connectionStrings>
    <add name="Infoteam.CliniqueLaSource.DocuShare.DatabaseAccess.Properties.Settings.ClsConnectionString"
        connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Workspace\CliniqueLaSource.CLS-DocuShare\Main\Resources\Cls.mdb;Persist Security Info=True"
        providerName="System.Data.OleDb" />
  </connectionStrings>

What I’ve in the Settings.settings file:

<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Infoteam.CliniqueLaSource.DocuShare.DatabaseAccess.Properties" GeneratedClassName="Settings">
  <Profiles />
  <Settings>
    <Setting Name="ClsConnectionString" Type="(Connection string)" Scope="Application">
      <DesignTimeValue Profile="(Default)">
        &lt;?xml version="1.0" encoding="utf-16"?&gt;
        &lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;ConnectionString&gt;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Cls.mdb;Persist Security Info=True&lt;/ConnectionString&gt;
        &lt;ProviderName&gt;System.Data.OleDb&lt;/ProviderName&gt;
        &lt;/SerializableConnectionString&gt;
      </DesignTimeValue>
      <Value Profile="(Default)">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Cls.mdb;Persist Security Info=True</Value>
    </Setting>
  </Settings>
</SettingsFile>

Here is a small example of the usage I’m doing:

    ClsDataSet dataSet = new ClsDataSet();
    DOCDOCUMENTSTableAdapter adapter = new DOCDOCUMENTSTableAdapter();
    adapter.Fill(dataSet.DOCDOCUMENTS);
    return dataSet.DOCDOCUMENTS.ToList();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:12:50+00:00Added an answer on May 23, 2026 at 4:12 am

    When VS creates a strongly typed DataSet for you, it will also create strongly typed wrappers around DataAdapters to fill your DataSet and to update the database.

    These strongly typed wrappers or TableAdapters can be configured to use any connection you want. Simply set the Connection property to a connection initialized with the connection string you wish and you are all set.

    If setting the connection everytime you create a new TableAdapter is too cumbersome you can also take advantage of them being partial classes. This means you can add another code file that wont be overwritten everytime the DataSet designer tool updates the underlying code and overload the DataTable constructor so it takes a connection string or a connection instance and you set the property accordingly inside the constructor:

     public partial class MyTableTableAdapter
     {
         public MyTableTableAdapter(OleDbConnection connection)
         {
              if (connection == null)
                  throw new ArgumentNullException("connection");
    
              base.Connection = connection;
         }
    
         public MyTableTableAdapter(string connectionString)
         {
              base.Connection = new OleDbConnection(connectionString);
         }
    }
    

    If you have a lot of TableAdapters this might be a bore and your better off just setting the connection manually each time you instantiate a TableAdapter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several libraries that I want to import into my project. They are
Do you know how to access textboxes added to a radgrid that are not
How do I access an image during run time that I have added to
I'm wondering if there is a way to access the Markers that were added
I added a text file to a testapp's solution and I want to read
I created a sample Silverlight Web project and I am getting 'Access is denied'
I have created a basic project in to which i have added a really
ADDED: This question is now, I believe, subsumed by this one: Using GNU Screen
I added some simple WatiN tests to our app today to check that a
I have a ASP.Net project that is setup in such a way that it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.