1

我在sql server中运行它时查询它给了我正确的结果,但是我输入我的代码结果改变了?

这是我的查询

String data = "SELECT [dat] ,[product_id] FROM [market].[dbo].[product] where dat>='2012-11-1' and dat='2012-11-1'

这是我的代码

SqlConnection con=new SqlConnection (@"Data Source=.\Ahmed;Initial Catalog=Market;Integrated Security=True");
String data = "SELECT [dat] ,[product_id]FROM [market].[dbo].[product] where dat>='2012-11-1' and dat<='2012-11-31'";
con.Open();
SqlDataAdapter ad1 = new SqlDataAdapter(data, con);
DataSet ds1 = new DataSet();
ad1.Fill(ds1);
ReportDocument cr  = new ReportDocument();
cr.Load(@"C:\Users\Ahmed\Documents\VisualStudio2010\Projects\WindowsFormsApplication9\WindowsFormsApplication9\CrystalReport4.rpt");
cr.SetDataSource(ds1.Tables["product"]);
crystalReportViewer1.ReportSource = cr;

结果在 sql server Product_id dat 101 2012-11-1 102 2012-11-1

在 C# 中是这样的:

product_id 日期 100 2012-10-10 101 2012-11-1 102

4

0 回答 0