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
Pavithra L
NA
336
63.5k
Based on the date want to filter data's from datatable
Sep 2 2015 5:49 AM
In my project I am using report form. here I want to filter data based on from date to Todate.
Am I using two datetimepicker one for fromdate and one for Todate.
Here is my code. This cannot filter the correct date values it can filter whole data's of that table.Kindly give me any suggestion to overcome this problem .
else if (comboBox1.Text == "Date Range")
{
SqlDataAdapter da = new SqlDataAdapter("select V_No,Date1,Employee,Reference,Purpose,S_No,Machine,Job_No,Item,Qty,UOM,T1,Prepared_By,Remarks from In_House_Issues where Date1 between '" + dateTimePicker1.Text + "' AND '" + dateTimePicker2.Text + "' ", con);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
if (centeredContentOnpageToolStripMenuItem.Checked == true)
{
dataGridView1.Columns[12].Visible = false;
dataGridView1.Columns[13].Visible = false;
dataGridView1.Columns[14].Visible = false;
}
else
{
dataGridView1.Columns[12].Visible = true;
dataGridView1.Columns[13].Visible = true;
dataGridView1.Columns[14].Visible = true;
}
}
Reply
Answers (
9
)
How to use Database connectivity with SQL Server for MVC.
View database table data , date is the main source to filter