title: Connection String in a VB.NET Application
body: <p>I used to work only with asp.net websites before. I know that in ASP.NET website, the connection string is found in the web.config file.</p>
  
  <p>My problem is now I have started working with VB.NET applications which needed to be interfaced to a database. How is a connection string created and where should I put it?</p>
  
  <p>Thanks!</p>
  
  <p>Here's the whole app.config file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt; 
    &lt;connectionStrings&gt;
      &lt;add name="dbAsthmaConnectionString" connectionString="Data Source=9300-00\SQLEXPRESS;Initial Catalog=dbStore;Persist Security Info=True;User ID=johnsmith;Password=1234" providerName="System.Data.SqlClient"/&gt;
    &lt;/connectionStrings&gt;
  
    &lt;system.diagnostics&gt;
      &lt;sources&gt;
        &lt;!-- This section defines the logging configuration for My.Application.Log --&gt;
        &lt;source name="DefaultSource" switchName="DefaultSwitch"&gt;
           &lt;listeners&gt;
             &lt;add name="FileLog"/&gt;
               &lt;!-- Uncomment the below section to write to the Application Event Log --&gt;
               &lt;!--&lt;add name="EventLog"/&gt;--&gt;
           &lt;/listeners&gt;
        &lt;/source&gt;
      &lt;/sources&gt;
      &lt;switches&gt;
        &lt;add name="DefaultSwitch" value="Information" /&gt;
      &lt;/switches&gt;
      &lt;sharedListeners&gt;
        &lt;add name="FileLog"
             type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
             initializeData="FileLogWriter"/&gt;
        &lt;!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log --&gt;
        &lt;!--&lt;add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/&gt; --&gt;
      &lt;/sharedListeners&gt;
    &lt;/system.diagnostics&gt;
  &lt;/configuration&gt;
  </code></pre>