Click here to Skip to main content
15,893,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to create Crystal Report on asp.net with C#

I have two tables 'Sales,TempSales'

In my table has following
Sales
Billno  Billdate  BillAmount Tax TPTCharge ..........NetTotal
E001     3/4/2012   3000      1    1.................3500
E002     4/4/2012    2000     2    2.................2200

TempSales
Billno  Item     Qty Rate Amount

E001    kova       1  20    20
E001    kalakandu  2  30  60
E002     Paneer    1   40  40
E002      cheese    1   50  50

I want to get report from Both tables

So i give the following code but it is not working


SqlDataAdapter da = new SqlDataAdapter("Select T1.Billno,T1.Billdate,T1.BillAmount,T1.TPTCharge,T1.LBCharge,T1.Nettotal,T1.Tax,T1.Discount,T1.CName,T1.ONo,T1.Vno,T2.Item,T2.qty,T2.Rate,T2.Rate_Typ,T2.Amount,T2.Tax from Sales T1,Tempsales T2 where T1.Billno=T2.Billno and T2.Billno=T1.Billno and T1.Billdate>='" + DateTime.Parse(TextBox1.Text).ToString("MM/dd/yyyy") +"' and T1.Billdate<='" + DateTime.Parse(TextBox2.Text).ToString("MM/dd/yyyy") +"' order By T1.Billno", connect.cn());

The report is display all the records in second table

I give the following code to generate report
ReportDocument rptdoc = new ReportDocument();
      rptdoc.Load(Server.MapPath("SalesReport.rpt"));
      rptdoc.SetDataSource(ds.Tables[0]);

Please anybody help for this problem
Posted
Updated 5-Apr-12 0:04am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900