title: How to retrieve date from sqlite database
body: <p>My code is below. I want to get date within a string variable.</p>
  
  <pre><code>SQLiteCommand sqlite_cmd;
  SQLiteDataReader sqlite_datareader;
  SQLiteConnection sqlite_conn;
  
  // create a new database connection:
  sqlite_conn = new SQLiteConnection(sConnectionString);
  
  // open the connection:
  sqlite_conn.Open();
  
  // create a new SQL command:
  sqlite_cmd = sqlite_conn.CreateCommand();
  
  //Check is there any project with the same information
  sqlite_cmd.CommandText = "Select * from prework;";
  
  try
  {
      sqlite_datareader = sqlite_cmd.ExecuteReader();
      while (sqlite_datareader.Read()) // Read() returns true if there is still a result line to read
      {
          // Print out the content of the text field:
          //String str = sqlite_datareader["date"].ToString();
          String str = Convert.ToDateTime(sqlite_datareader[4].ToString());
          MessageBox.Show(""+str);
      }
  }
  catch
  {
      MessageBox.Show("error");
  }
  
  sqlite_conn.Close();
  </code></pre>
  
  <p>I want to take the date in a string variable. And then I will show date in a text box.</p>