title: attach 2 sqlite database and select tables
body: <p>i have problem when i try to select join tables from different sqlite database with attach database command and put the value into datagridview</p>
  
  <p>they get many error e.g: databases cannot open, ExuteNonQuery error, cannot open connection, cannot open databases.</p>
  
  <p>pathinfo2 as my master db and pathinfo1 as my db2 </p>
  
  <p>this my code:</p>
  
  <pre><code>Sub slc_smscontact()
      Dim fc1 As String = "Data Source=" + pathinfo2.Text + ";Version=3;"
      Dim SQL As String = "ATTACH '" + pathinfo1.Text + "' AS db2"
      Dim com As New SQLiteCommand(SQL)
      Dim connection As SQLiteConnection = New SQLiteConnection(fc1)
      'connection.ConnectionString = fc1
      com.Connection = connection
      connection.Open()
      Dim retval As Integer = 0
      Try
          retval = com.ExecuteNonQuery()
      Catch ex As Exception
          MessageBox.Show("An error occurred, your attach databases was not completed.")
      Finally
          com.Dispose()
      End Try
  
      SQL = "select distinct a.data1 no_telp, b.data1 nama, db2.sms.address, db2.sms.body, db2.sms.date, db2.sms.date_sent, db2.sms.Thread_id from (select raw_contact_id,data1 from data where mimetype_id = 5) as a, (select raw_contact_id,data1 from data where mimetype_id = 7) as b where a.raw_contact_id = b.raw_contact_id INNER JOIN db2.sms ON data.no_telp = db2.sms.address;"
      com = New SQLiteCommand(SQL)
      com.Connection = connection
      'retval = 0
      Try
          Dim ds3 As New DataSet()
          Dim da3 As New SQLiteDataAdapter(com)
          da3.Fill(ds3)
          grid3.DataSource = ds3.Tables(0).DefaultView
          'retval = com.ExecuteNonQuery()
      Catch ex As Exception
          MessageBox.Show("An error occurred, your select was not completed.")
      Finally
          'com.Dispose()
          connection.Close()
      End Try
  End Sub
  </code></pre>
  
  <p>there are anyone know how to fix it? </p>