title: Connection String Class and correct way to use texbox inputs?
body: <p>I have windows form application and below component C#... also I created connection class for my connection string. What is the best way to use textBox inside my connection string? should I create getters and setters class for textBox inputs to generate parameter and use it inside my connection string? Please give me example... Thanks!</p>
  
  <p><em><strong>My TextBoxes</em></strong></p>
  
  <blockquote>
    <p>userDataSourceTextBox</p>
    
    <p>userIDTextBox</p>
    
    <p>userPasswordTextBox</p>
  </blockquote>
  
  <p><em><strong>Myconnection Class</em></strong></p>
  
  <pre><code>class Connection
      {
          public static OracleConnection getConnection()
          {
              OracleConnection con = new OracleConnection("Data Source=" + userDataSourceTextBox.Text + ";User Id=" + usernameTextBox.Text.ToUpper() + ";Password=" + userPasswordTextBox.Text + ";");
              return con;
          }
      }
  </code></pre>
  
  <p><em><strong>MainForm</em></strong>   </p>
  
  <pre><code>               OracleConnection conn1 = Connection.getConnection() 
                 conn1.Open();
  
                  using (OracleCommand Names = new OracleCommand("SELECT TABLE_NAME FROM USER_TABLES ORDER BY TABLE_NAME", conn1))
                  {
                      using (OracleDataReader reader = Names.ExecuteReader())
                      {                            
                          while (reader.Read())
                          {                                    
                              //Do something                              
                          }
                      }
                  }
  </code></pre>