Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
I hv made application in which
I need to create bill customer in following pattern

FPan. Firm name. Mobile
Firm Address. Phone
customers name

1 l x l7000 lfromdate l todate
2 l y l 3000 l fromdate l todate
.
.
.

Total 10000

Dt1 has firm and customers details in one row.
and Dt2 has customer's service details multiple rows
Plz kindly
help in to code
Posted

 
Share this answer
 
Comments
Meenakshi Moolani 22-Jul-15 5:16am    
Hello mika wendelious
I have data base in MSSQL 2008
and really tried many links and downloaded many examples bt didn't solve my problem . So asking plz kindly help on this
dt1 and Dt2 is called by store procedure
Wendelius 22-Jul-15 6:25am    
There's really nothing to start with. If you have an exact problem, please post relevant code parts and explain where you're stuck at.
Meenakshi Moolani 22-Jul-15 7:37am    
There's is really nothing to start code.
Plz kind to this.
Meenakshi Moolani 22-Jul-15 13:06pm    
Hello Mika wendelius
it first time for me that doing with crystal reports if u can help me plz
thanks in advance
Wendelius 22-Jul-15 13:23pm    
I really don't know how to help you create the report but I suggest that you try the example Creating a simple but useful Crystal Report[^]. Go through it step by step and you should be able to create a report which you can use for bill.
Hello Meenakshi,
Just Refer the Below Example.

step 1:- Add New Form and Drag & Drop the CrystalReportViewer and set its Dock property to Fill.

step 2:- Now Right Click on your Project and Click on add New Item (Ctrl+shift+a), After open Popup Choose the Reporting tab from vertical tab and select the CrystalReport.
e.g. "crystalreport1.rpt"

step 3:- After that, Right Click on your Project and Click on add New Item (Ctrl+shift+a), After open Popup Choose the Data tab from vertical tab and set Dataset.
e.g. "DataSet1.xsd"

step 4:- Now Just Right Click and Add datatable then Add the Column to that Datatable.
e.g  I have use the Column name Such as "empID","empName","address","city","contactNo".

step 5:- After that Click on crystalreport1.rpt and Just go Field Explorer & Right Click on Database Fields and select Database expert and go in ProjectData and add Datatable Now expand the Database field and Datatable Your Database Field is ready to use.

step 6:- Now Drag and Drop Database Field From Datatable and put in section3(Details) of Crystal Report1.rpt.


C#
Now Do the Following Code :-

 private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
         ReportDocument rd;
            DataSet1 ds = new DataSet1(); //Dataset Name
            DataTable dt = ds.Tables["DataTable1"]; // Datatable Name
            DataRow dr;
            for (int i = 1; i <= 100; i++)
            {
                dr = dt.NewRow();
                dr["empID"] = i;
                dr["empName"] = "John Carry";
                dr["address"] = "Street 001, Rivera Green, CA";
                dr["city"] = "Tracy";
                dr["contactNo"] = "9876543210";
                dt.Rows.Add(dr);
            }
            rd = new CrystalReport1(); // ReportFile Name that CrystalReport1.rpt
            rd.SetDataSource(dt);
            crystalReportViewer1.ReportSource = rd;
            crystalReportViewer1.Refresh();
        }
 
Share this answer
 
v2
Comments
Anil Vaghasiya 23-Jul-15 8:56am    
Hello,
Use Below Code If You want to Use StoredProcedure
ReportDocument rd;
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
using (SqlConnection sqlcon = new SqlConnection("Data Source=ASIFD-3\\ASI2008;Initial Catalog=master;Integrated Security=True"))
{
sqlcon.Open();
SqlCommand sqlcmd = new SqlCommand("asiSelectAllEmployee", sqlcon);
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.ExecuteNonQuery();
da.SelectCommand = sqlcmd;
da.Fill(ds);
}
rd = new CrystalReport1(); // ReportFile Name that CrystalReport1.rpt
rd.SetDataSource(ds.Tables[0]);
crystalReportViewer1.ReportSource = rd;
crystalReportViewer1.Refresh();
Meenakshi Moolani 7-Aug-15 14:37pm    
Hello
First of all sorry could not reply your ans, was changing clients's other requirements. I did Above's example facing following issue
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
Meenakshi Moolani 7-Aug-15 15:05pm    
The above error solved by adding code in app.config file
<startup uselegacyv2runtimeactivationpolicy="true">
<supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0">

But facing one following issue
cannot determine the queries necessary to get data for this report.
Failed to riveter data from the database.
Error in File temp_db3e79d6-8n62-40af-beb8-5164999e32bb{E9804012-12AB-4BA98-A1623F723AAC}.rpt
Failed to riveter data from the database.

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