TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shovan Saha
NA
321
92.6k
Add a condition
Jul 24 2017 3:58 PM
I want to add a condition:
dgvrow.Cells["CibtcaNO"].Value.ToString() != ""
. How? Please help me.
private void btnAdjusted_Click(object sender, EventArgs e)
{
con = new OleDbConnection(conString);
if (comboBoxEnterSuspenseAccount.Text != "")
{
var query = "SELECT * FROM LalData " +
" WHERE " +
"SuspenseAccount = @suspenceAccount1 " +
"AND " +
"(PaymentDate BETWEEN @firstDate AND @lastDate)";
con.Open();
OleDbCommand cmd = new OleDbCommand(query, con);
cmd.Parameters.AddWithValue("@suspenceAccount1 ", 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();
}
}
Reply
Answers (
3
)
Three button click events in c# accessing the same docx
Convert HTML to PDF