title: insert if not exists in sqlite with vb.net
body: <p>I have records from server that I want to copy, so I used datareader to select all, during selection the insert also process.
  This is the pseudo code:</p>
  
  <pre><code>while datareader.read
          For f As Integer = 0 To datareader.FieldCount - 1
                  Values = Values &amp; datareader.GetValue(f)
          Next
      Dim ss as string ="Insert into xtable(a,b,c,d,e,f) select " &amp; values &amp; " where not Exist (select * from xtable)" ''//is this right?
      Dim sc as new sqliteCommand(ss,mycon)
      sc.ExecuteNonQuery
      End While
      sc.dispose
  </code></pre>
  
  <p>What is the exact sql statement to insert only if record doesn't exist in my current table?</p>
  
  <p>I used some of this code, but a filter was defined: like x
  What if I just want to insert records that doesn't exist in the table I want.</p>
  
  <pre><code>Dim ss As String = "insert into xtable(x,y,z) select $x, $y,$z 
  where not exists (select 1 from xtable where x=$x)"
  </code></pre>