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 7650697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:19:11+00:00 2026-05-31T11:19:11+00:00

I am new to windows forms programming and I was wondering what would be

  • 0

I am new to windows forms programming and I was wondering what would be the best way to create like a connectionstring.config (i dont know how to do this) I have seens it , its like an xml giving all the information to connect to the database, in my case I am connecting to a MySql database. I would like to have so i could do something like this (I KNOW THIS IS WRONG BUT YOU GET MY IDEA):

MySqlConnection conn = new MySqlConnection
(Someconfiguration.thatconnects.toMyXMLOrSomething["MyXMLFile]);

something like that, i know i am probably too far from what it is.. but I have seen this somewhere and i think its clean, instead of putting the data connection information everywhere i need it.

so a few questions:

  • How do i create that xml file in VS2010?
  • Where do I place that file?
  • How should I call it in the functions where i am using it?.

I would really appreciate all the possible help as I am learning and would like to keep everything separate and clean like this.

Thank you for your help and valuable time to help me.

  • 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-31T11:19:12+00:00Added an answer on May 31, 2026 at 11:19 am

    You can put them in a specific node inside your app.config file.

    Here’s the MSDN documentation for adding the app.config file to your project and it includes adding connection strings: http://msdn.microsoft.com/en-us/library/ms243192(v=vs.100).aspx

    <configuration>
        <connectionStrings>
            <add name="myConnectionString" connectionString="Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;" />
        </connectionStrings>
    <configuration>
    

    You can then use the built in .NET ConfigurationManager class to pull it out:

    ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background In Visual Studio 2008 Create a new Windows Forms Application, this will create
I'm starting a new project here (Windows Forms). What's the best option today for
In Windows Forms programming, I have this general problem. When the page is loading
I'm very new to web programming with MVC so i dont know how to
I'm really new to Windows Forms programming and not quite sure what's the right
In Visual Studio, two files are created when you create a new Windows Form
I tryed to create new components from one base Windows Form, also I found
I am an inexperienced programmer , completely new to programming for windows . I
I am new to Windows programming, as in my previous work I've mostly been
Am very new to Android programming, so sorry if this is a simple problem.

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.