我查询当我在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 dat 100 2012-10-10 101 2012-11-1 102