Click here to Skip to main content
15,893,508 members

how to genarate invoice crystal report using dataset with multiple tables C# ASP.NET in vs 2010

rohitatcp asked:

Open original thread
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
Tags: C#, ASP.NET, CrystalReports

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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