crystal report date to date query result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ahmedmii
    New Member
    • Nov 2012
    • 1

    crystal report date to date query result

    Hello,

    I've query when I run it in the sql server it gives me the correct result ,but I put in my code the result changed?

    This is my query
    Code:
    String data = "SELECT [dat] ,[product_id] FROM [market].[dbo].[product] where dat>='2012-11-1' and dat='2012-11-1'
    This is my code

    Code:
    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\Visual Studio 2010\Projects\WindowsFormsApplication9\WindowsFormsApplication9\CrystalReport4.rpt");
    
                            cr.SetDataSource(ds1.Tables["product"]);
    crystalReportViewer1.ReportSource = cr;
    The result in sql like this:

    Product_id dat 101 2012-11-1 102 2012-11-1

    In C# like this:

    product_id dat 100 2012-10-10 101 2012-11-1 102 2012-11-1
    Last edited by zmbd; Nov 4 '12, 02:02 PM. Reason: Please use the <CODE/> button to format you posted code.
Working...