Shovan Saha

Shovan Saha

  • NA
  • 321
  • 91.7k

Please check my code

Aug 3 2017 12:52 PM
Dear All, This code is for searching empty cells of certain column. Now I want to search not empty cells of certain column. Please help me.
Here is my code:
 
if (comboBoxEnterSuspenseAccount.Text != "")
{
con = new OleDbConnection(conString);
var query6 = "SELECT * FROM LalData " +
" WHERE " +
"SuspenseAccount = @suspenceAccount1 " +
"AND[CibtcaNo] = '" + DBNull.Value + "'" +
"AND " +
"(PaymentDate BETWEEN @firstDate AND @lastDate)";
con.Open();
OleDbCommand cmd = new OleDbCommand(query6, con);
cmd.Parameters.AddWithValue("@suspenceAccount6 ", DbType.String).Value = comboBoxEnterSuspenseAccount.Text.ToString();
cmd.Parameters.AddWithValue("@firstDate ", DbType.Date).Value =
dtpFirstDate.Value.ToShortDateString();
cmd.Parameters.AddWithValue("@lastDate ", DbType.Date).Value =
dtpLastDate.Value.ToShortDateString();
adapter = new OleDbDataAdapter(cmd);
adapter.Fill(dt);
dataGridView1.DataSource = dt;
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
con.Close();
}
 
 

Answers (3)