title: VB.net - Open local sqlite table
body: <p>I'm trying to open a locally stored file (SQLite) just to pull some lines from specific tables. The issue that I'm having is that I keep getting errors that the connection could not be made (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) which makes perfect sense because this is not a sql server it is just information stored in a local database file. So am I going about this the wrong way or is this the only method to process a .db or similar file and I've overlooked something?</p>
  
  <pre><code>    Dim connection As String = "Data Source=" &amp; Form1.connstring &amp; "; Integrated Security=true"
      Dim SQLConn As New SqlConnection
      Dim SQLcmd As New SqlCommand
      Dim SQLdr As SqlDataReader
  
      SQLConn.ConnectionString = connection
      SQLConn.Open()
  
      SQLcmd.Connection = SQLConn
      SQLcmd.CommandText = SQLstr
      SQLdr = SQLcmd.ExecuteReader()
      While SQLdr.Read()
          MessageBox.Show(SQLdr.ToString)
          Form1.ListBox1.Text = SQLdr.ToString
      End While
  
      SQLdr.Close()
      SQLConn.Close()
  </code></pre>
  
  <p>Form1.connstring is the full file path. 
  I've tried a few different types of syntax on the "Data Source=" line to try and reference this as a local file but so far I'm lost.</p>
  
  <p>This is for a tool that will have to scan different database files - all locally stored - to farm information</p>
  
  <p><em><strong>EDIT</em></strong></p>
  
  <p>Solution:</p>
  
  <pre><code>Imports System.Data.SQLite 'Interop available on NuGet
  
  Public Class _SQLite
  
  Public Shared Sub SQLInq()
      'Value to search as SQL Query - return first match
      Dim SQLstr As String = "Select * FROM FsFileVersion WHERE FileDescription_LTH = 'Entry' LIMIT 1;"
  
      'Define file to open - .path passed from parent form
      Dim connection As String = "Data Source=" &amp; _Compression.path
      Dim SQLConn As New SQLiteConnection(connection)
      Dim SQLcmd As New SQLiteCommand(SQLConn)
      Dim SQLdr As SQLiteDataReader
      SQLConn.Open()
  
      SQLcmd.Connection = SQLConn
      SQLcmd.CommandText = SQLstr
      SQLdr = SQLcmd.ExecuteReader()
  
      'For each query returned
      While SQLdr.Read()
          'Insert into textbox
          Form1.Textbox1.Text = (SQLdr.GetString(SQLdr.GetOrdinal("FileVersion_LTH")))
      End While
  
      'End the connection
      SQLdr.Close()
      SQLConn.Close()
  End Sub
  </code></pre>
  
  <p>End Class</p>