Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
hello everyone...

I m currently using vs2010. In that i want to generate crystal report for invoice.

My database tables are Table 'A' and Table 'B' which are as follows
-----------------------------------------------------------------
Table 'A'
------------------------------------------------------------------
invoiceid  | invoicedate | subtotal | tax1  | tax2 | Grand Total

   1          07/13/2012     500.00    VAT    CST      700
   2          09/08/2011     800.00    VAT    Sales    1000
------------------------------------------------------------------


-----------------------------------------------------------------
Table 'B'
------------------------------------------------------------------
invoiceid  | invdetid  | itemno | itemname  | qty | rate  | amount

   1            1         1        item A      5     10.0    50.0
   1            2         2        item B      3     5.00    15.00 
   2            3         1        item A      10    12.00   120.00 
------------------------------------------------------------------

so here..i m using dataset in which, i m taking two tables,i.e. Table 'A' and
Table 'B'
and my query in procedure is
SQL
select A.invoiceid,A.invoicedate,A.subtotal,A.tax1,A.tax2,A.Grand Total,
       B.invoiceid,B.invdetid,B.itemno,B.itemname,B.qty,B.rate,B.amount
 from Table A,Table B
where A.invoiceid=B.invoiceid

so by this query i m getting result by invoice number.

My aspx.cs code is
---------------------
C#
Con = new SqlConnection(strConnString);
                Con.Open();
                cmd.CommandText ="TestReport";
                cmd.CommandType = CommandType.StoredProcedure;
                
                cmd.Connection = Con;
                adapter = new SqlDataAdapter(cmd);
                ds = new DataSet();
                adapter.Fill(ds,"A");
                adapter.Fill(ds,"B");
                rptDoc.Load(Server.MapPath("/Report/InvoiceReport.rpt"));

                
                rptDoc.SetDataSource(ds);
                CrystalReportViewer1.ReportSource = rptDoc;
                CrystalReportViewer1.RefreshReport();

-------------------------------------------
here i m getting data in dataset ..but while displaying it is showing no data on report..

please help..

Thanks in advance
Posted
Updated 12-Jul-12 23:43pm
v4
Comments
Sandeep Mewara 13-Jul-12 2:50am    
You got one query in SP and you are filling dataset twice using adapter, can you share it why?

Further, did you check if the data is returned and filled in dataset before assigning to reports? DEBUGGED it?
Kuldeep B 11-Dec-12 1:45am    
Use two datasets and then use Merge methode..

You need to write your query in command of ur design report page for the fields that you display in report. for more you can refer below links:

Step by Step Creation of Crystal Report using its Features Group, Graph, Cross-Tab and Sub Report,

Generate a Report using Crystal Reports in Visual Studio 2010
 
Share this answer
 
im also having the same query please someone help me.....!!!!!!pls
 
Share this answer
 

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