title: Retrieving data from SQLite in Unity3D
body: <p>I'm Having a problem with my query</p>
  
  <p>HighScoreGrammarI</p>
  
  <p>-- getting data from sqlite</p>
  
  <pre><code> private void GetGrammarIScore()
      {
          highScores.Clear();
  
          using (IDbConnection dbConnection = new SqliteConnection(Connection))
          {
              dbConnection.Open();
  
              using (IDbCommand dbCmd = dbConnection.CreateCommand())
              {
                  string select = String.Format("Select Hs_date, Hs_answer, Hs_score from Highscores_data where Hs_stage = 'GrammarI' and Hs_name = (\"{0}\")", Username.text);
  
                  dbCmd.CommandText = select;
  
                  using (IDataReader reader = dbCmd.ExecuteReader())
                  {
                      while (reader.Read())
                      {
                          highScores.Add(new HighScore(reader.GetDateTime(0), reader.GetInt32(1), reader.GetInt32(2)));
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>-- showing data using the get data void</p>
  
  <pre><code> private void showGrammarI()
      {
          GetGrammarIScore();
          for (int i = 0; i &lt; highScores.Count; i++)
          {
              GameObject tmpobjec = Instantiate(ScorePrefab);
  
              HighScore tmpScore = highScores[i];
  
              tmpobjec.GetComponent&lt;HighscoreScript&gt;().SetScore(tmpScore.Date.ToString(), tmpScore.CorrectAnswer.ToString(), tmpScore.Score.ToString());
          }
      }
  </code></pre>
  
  <p>HighscoreScript</p>
  
  <pre><code>public GameObject Date;
      public GameObject CorrectAnswer;
      public GameObject Score;
  
      public void SetScore(string date, string correctanswer, string score)
      {
          this.Date.GetComponent&lt;Text&gt;().text = date;
          this.CorrectAnswer.GetComponent&lt;Text&gt;().text = correctanswer;
          this.Score.GetComponent&lt;Text&gt;().text = score;
      }
  </code></pre>
  
  <p>HighScore </p>
  
  <pre><code>public DateTime Date { get; set; }
  
      public int CorrectAnswer { get; set; }
  
      public int Score { get; set; }
  
      public HighScore(DateTime date, int correctanswer, int score)
      {
          this.Date = date;
          this.CorrectAnswer = correctanswer;
          this.Score = score;
      }
  </code></pre>
  
  <p>THE ERROR IS HERE:</p>
  
  <blockquote>
    <p>InvalidCastException: Cannot cast from source type to destination type.
    Mono.Data.Sqlite.SqliteDataReader.VerifyType (Int32 i, DbType typ)
    Mono.Data.Sqlite.SqliteDataReader.GetDateTime (Int32 i)HighScoreGrammarI.GetGrammarIScore () (at Assets/Script/HighScoreGrammarI.cs:73)  >> this line is inside the while query in HighscoreGrammarI</p>
  </blockquote>