Shovan Saha

Shovan Saha

  • NA
  • 321
  • 92.6k

date query problem

Jul 27 2017 2:21 PM
Dear All, please check my code: Why there is no result?
 
private void btnAdjusted_Click(object sender, EventArgs e)
{
con = new OleDbConnection(conString);
if (comboBoxSelectSuspenseAccount.Text != "")
{
var query = "SELECT * FROM LalData " +
" WHERE " +
" (PaymentDate between '" + dtpFirstDate.Text.ToString() + "' AND '" + dtpLastDate.Text.ToString() + "')" +
"AND " +
"SuspenseAccount like '" + comboBoxEnterSuspenseAccount.SelectedItem.ToString() + "'";
con.Open();
if (dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[10].ToString() != "")
{
adapter = new OleDbDataAdapter(query, con);
dt = new DataTable();
adapter.Fill(dt);
dataGridView1.DataSource = dt;
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
btnSubmit.Enabled = false;
con.Close();
}
}
 

Answers (2)