title: How to connect with two different databases by one connection string Sql and Vb.Net
body: <p>I am trying to connect to database at window form level in Studio 2010/VB.Net. I am using two different databases in Sql 2008r2. One database I am using to populate records at form load event (run time) and when users pick their selection or any modification from that form, data should be updated to other database by instert, update, delete and save commands for user's future reference.</p>
  
  <p>Is it possible to connect with two different databases using one Connection String? </p>
  
  <p>Do I need to add two database name in below mentioned code somewhere?</p>
  
  <pre><code>Imports System.Data.SqlClient
  
  Dim con As New SqlClient.SqlConnection("data source=DATASOURCE;initial catalog=NAME OF DATABASE;Integrated Security=True")
  Dim cmd As New SqlCommand()    
  cmd.Connection = con    
  con.Open()    
  con.Close()
  </code></pre>
  
  <p>OR</p>
  
  <p>Should I use two database below somewhere?</p>
  
  <pre><code>Imports System.Data.SqlClient
  
  Public Class NEW_PERSONAL_INFORMATION
  
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  
      Dim con As New SqlClient.SqlConnection("data source=ROOM310-40\SQLEXPRESS;initial catalog=DTIS;Integrated Security=True")
  
      Dim cmd As New SqlCommand()    
      cmd.Connection = con    
      con.Open()    
      con.Close()
    End Sub
  
  End Class
  </code></pre>
  
  <p>Apologies If I am seeking help in simple thing or not able to explain it enough.</p>
  
  <p>I would appreciate any help.</p>