Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
StartDate and EndDate data select in datagridview
Shovan Saha
Mar 18 2017 4:28 PM
163
Reply
I have MS access database and form C# windows application managed by visual studio 2015. PaymentDate is a column name. I want to select from datagridview StartDate and EndDate with text box or datetimepicker using search button. But within a month it is good. But when I select one month to another month then it select full database. Here is my code:
private void btnSearch_Click(object sender, EventArgs e)
{
con = new OleDbConnection(conString);
string sql = "SELECT * FROM LalData WHERE PaymentDate between '" + txtStartDate.Text.ToString() + "' AND '" + txtEndDate.Text.ToString() + "'";
con.Open();
adapter = new OleDbDataAdapter(sql, con);
dt = new DataTable();
adapter.Fill(dt);
dataGridView1.DataSource = dt;
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
btnSubmit.Enabled = false;
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
UWP not working in Xamarin Crossplatform project.
C# GUI Interface