我已经采取了显示按钮,代码是:-
private void btnDisplay_Click(object sender, EventArgs e)
{
DateTime selectedDate = DateTime.Now;
String query = "SELECT sno,currDate,WtrNm,Type,No FROM WtrTblAllot WHERE currDate = @SelectedDate";
SqlCommand command = new SqlCommand(query, con);
command.Parameters.AddWithValue("@SelectedDate", selectedDate);
SqlDataAdapter da = new SqlDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds);
dgvWtrAllot.DataSource = ds.Tables[0];
}
问题是它在单击时显示数据网格视图,但不显示选定的日期数据。
datetimepicker 的编码区域:-
private void dtTmPkrWtr_ValueChanged(object sender, EventArgs e)
{
}