In this section of code I select a range of dates to use to get the rows from a SQLite database file "Mytable1 table name "Date". The SELECT command I am using works correctly when using a SQLite database manager program but using C# in a windows form the dates returned are not between the date range requested.
Anyone run into this issue before?
I use a DataView Grid to display the return data and a button to SELECT the table and "Date coloum. A DataBase file (.zip) and a few lines of code I am using.
- using System.Data.SQLite;
-
- SQLiteConnection myConn;
- SQLiteDataAdapter myAdapter;
- DataTable myTable;
-
- private void Reports_Load_1(object sender, EventArgs e)
- {
-
- if (File.Exists(Application.StartupPath + "/mytable1.db3"))
- {
- string myDbPath = Application.StartupPath + "/mytable1.db3";
-
- myConn = new SQLiteConnection("Data Source=" + myDbPath);
- myConn.Open();
- }
- else
- {
- MessageBox.Show("Data Base not found:" + Environment.NewLine +
- " Check file location and name");
- }
- }
- private void BtnGenerate_Click(object sender, EventArgs e)
- {
- myAdapter = new SQLiteDataAdapter ("SELECT DISTINCT * FROM Transaction_Table WHERE Date >= "+2018/01/01+" AND Date <= "+2018/01/04+";" , myConn);
-
- myTable = new DataTable();
-
- myAdapter.Fill(myTable);
-
-
-
-
- new SQLiteCommandBuilder(myAdapter);
-
-
-
-
- DataGridView1.DataSource = myTable;
- }