我是C#编程的新手,目前是学生,我们有一个有关使用datetimepicker对记录进行排序的项目,您可以帮我吗。 我这里有一个绑定到我的datagridview的类
public class Sales
{
public int Trans_Code{ get; set; }
public string Item_Name { get; set; }
public string Item_Desc { get; set; }
public string Item_Qty { get; set; }
public string Item_Price{ get; set; }
public DateTime Date { get; set; }
}
这是我的按钮,单击两个名为dtFromDate
(从该日期开始)dtToDate
(到该日期)的日期选择器。
private void btnLoad_Click(object sender, EventArgs e)
{
conn.Open();
string query = " SELECT * FROM tbl_sales WHERE Date BETWEEN '"+dtFromDate.Value+"' AND '"+dtToDate.Value+"'";
salesBindingSource1.DataSource = conn.Query<Sales>(query, commandType: CommandType.Text);
conn.Close();
}
this is the application and not sorting according to the datetimepicker on button click