myConnection = new SqlConnection(cs.DBConn);
MyCommand.Connection = myConnection;
MyCommand.CommandText = "select * from vwProfit Where OrderDateGet= '" + dateTimePicker1.Value.ToString() + "'";
MyCommand.CommandType = CommandType.Text;
myDA.SelectCommand = MyCommand;
myDA.Fill(myDS, "vwProfit");
rpt.SetDataSource(myDS);
frm.crystalReportViewer1.ReportSource = rpt;
frm.Show();
谁可以编辑Code Me, 我想选择日期而不显示数据
答案 0 :(得分:0)
以相同的格式转换两个日期时间,然后尝试。
MyCommand.CommandText = "select * from vwProfit Where Convert(varchar,OrderDateGet,103)= convert(varchar,'" + dateTimePicker1.Value.ToString() + "',103)";