title: Specified cast is not valid SQLite Empty SELECT Value
body: <p>I'm trying to sum a column WHERE date  BETWEEN  @from  AND  @to as shown below</p>
  
  <pre><code>DateTime from = DateTime.Parse(dt_From.Value.ToShortDateString());
  DateTime to = DateTime.Parse(dt_To.Value.ToShortDateString());
  SQLiteConnection con = new SQLiteConnection(Properties.Settings.Default.ConnectionString);
  SQLiteCommand cmd = null;
  con.Open();
  
  //Total Items Sold
  string query = " SELECT SUM(total) FROM acc_items_income WHERE date BETWEEN @from AND @to AND deleted = 0 ";
  cmd = new SQLiteCommand(query, con);
  cmd.Parameters.Add(new SQLiteParameter("@from", from));
  cmd.Parameters.Add(new SQLiteParameter("@to", to));
  </code></pre>
  
  <p>And i'm trying to read it, As shown</p>
  
  <pre><code>SQLiteDataReader dr = cmd.ExecuteReader();
  while (dr.Read())
  {
      double soldItems = dr.GetDouble(0);
      txtTotalSoldItems.Text = soldItems.ToString("c", naira);
  }
  </code></pre>
  
  <p>My error now is, when i select from a row where the datetime is not in the database, or can't SUM a column that does not have a value, then i get this error.</p>
  
  <p>Specified cast is not valid</p>