c#我想选择Where Datetime Show Crystal Report但不显示数据

时间:2016-07-11 06:25:50

标签: c# sql sql-server

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, 我想选择日期而不显示数据

1 个答案:

答案 0 :(得分:0)

以相同的格式转换两个日期时间,然后尝试。

MyCommand.CommandText = "select * from vwProfit Where Convert(varchar,OrderDateGet,103)= convert(varchar,'" + dateTimePicker1.Value.ToString() + "',103)";