title: How to fill datagrid from SQLite?
body: <p>After I created SQLite database on button click with code like this:</p>
  
  <pre><code>private void button_Click(object sender, RoutedEventArgs e)
          {
              SQLiteConnection sqlite_conn;
              SQLiteCommand sqlite_cmd;
              SQLiteDataReader sqlite_datareader;
  
              // create a new database connection:
              sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;New=True;Compress=True;");
  
              // open the connection:
              sqlite_conn.Open();
  
              // create a new SQL command:
              sqlite_cmd = sqlite_conn.CreateCommand();
  
              // Let the SQLiteCommand object know our SQL-Query:
              sqlite_cmd.CommandText = "CREATE TABLE airports (id integer primary key , airportName varchar(100) not null, airportCity varchar(45) not null, active tinyint(1));";
  
              // Now lets execute the SQL ;D
              sqlite_cmd.ExecuteNonQuery();
  
              // Lets insert something into our new table:
              sqlite_cmd.CommandText = "INSERT INTO airports (id, airportName, airportCity, active) VALUES (1, 'TestAirport1', 'TestCity1', 1);";
  
              // And execute this again ;D
              sqlite_cmd.ExecuteNonQuery();
  
              // ...and inserting another line:
              sqlite_cmd.CommandText = "INSERT INTO airports (id, airportName, airportCity, active) VALUES (2, 'TestAirport2', 'TestCity2', 1);";
  
              // And execute this again ;D
              sqlite_cmd.ExecuteNonQuery();
  
              // But how do we read something out of our table ?
              // First lets build a SQL-Query again:
              sqlite_cmd.CommandText = "SELECT * FROM airports";
  
              // Now the SQLiteCommand object can give us a DataReader-Object:
              sqlite_datareader = sqlite_cmd.ExecuteReader();
  
              // The SQLiteDataReader allows us to run through the result lines:
              while (sqlite_datareader.Read()) // Read() returns true if there is still a result line to read
              {
                  // Print out the content of the text field:
                  //System.Console.WriteLine(sqlite_datareader["text"]);
              }
  
              // We are ready, now lets cleanup and close our connection:
              sqlite_conn.Close();
          }
  </code></pre>
  
  <p>Everything is fine, database created, table created and some data inserted to table. (I check all with SQLite Manager on  MozzilaFirefox)</p>
  
  <p>My goal is to fill DataGrid on button click with data from database like this:</p>
  
  <pre><code>private void btnShow_Click(object sender, RoutedEventArgs e)
          {
  
              string database_connection = "Data Source=database.db;Version=3;New=True;";
              string query = String.Format("SELECT * FROM airports WHERE active = '1'");
  
              SQLiteConnection connection = new SQLiteConnection(database_connection);
              connection.Open();
  
              SQLiteCommand command = new SQLiteCommand(query, connection);
              SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(command);
  
              DataTable data = new DataTable();
              dataAdapter.Fill(data);
              dgAirports.DataContext = data;
  
          }
  </code></pre>
  
  <p>But then visual studio throw exception that table 'airports' doesen't exist and for real, the whole database become empty.</p>
  
  <p>How to fix that?</p>