Click here to Skip to main content
Sign Up to vote bad
good
See more: C#CrystalReports
 string query = "SELECT Account_Credit.Transaction_No, Account_Credit.Amount_Credit, Account_Credit.Credit_Date, Account_Credit.Total_Amount_Credit,     Account_Debit.Transaction_No, Account_Debit.Amount_Debit, Account_Debit.Debit_Date, Account_Debit.Total_Amount_Debit, Accounts.Account_No FROM Account_Credit INNER JOIN     Account_Debit ON Account_Credit.Transaction_No = Account_Debit.Transaction_No INNER JOIN Accounts ON Account_Credit.Account_No = Accounts.Account_No and Accounts.Account_No='" + cboaccount1.Text + "-" + cboaccount2.Text + "'";
                    da = new SqlDataAdapter(query, cn);
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("The Complete Info of Account No'" + cboaccount1.Text + "-" + cboaccount2.Text + "'does not Exists!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        cboaccount1.SelectAll();
                        cboaccount1.Focus();
                    }
                    else
                    {
                      
                   this.Close();
                   CrystalReport1 crt = new CrystalReport1();
                        crt.SetDataSource(dt);
                        Report_Viewer rpt = new Report_Viewer();
                        rpt.Show();
                        rpt.crystalReportViewer1.ReportSource = crt;
                        rpt.crystalReportViewer1.Refresh();
                        dt.Clear();
                        cn.Close();
                    }
                }
Posted 11 Jan '13 - 2:10
Edited 12 Jan '13 - 16:31

Comments
Sandeep Mewara - 11 Jan '13 - 10:41
You sure have data? Further, is crystal report designed to show data? Automatically it will not show the data.
zeshanazam - 11 Jan '13 - 10:45
yeah i m sure..
Sandeep Mewara - 11 Jan '13 - 10:52
You designed properly to show data? Mapped fields?
zeshanazam - 11 Jan '13 - 11:01
yup.data is accessing from 3 tables.
Sandeep Mewara - 11 Jan '13 - 11:03
Not accessing. Are they mapped to some field in report?
zeshanazam - 11 Jan '13 - 11:05
i made three datatables, made their relations and drag fields to report from datatables.
Dharmendra-18 - 13 Jan '13 - 2:48
for this data fields name will be same as table column name.

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 315
1 Aarti Meswania 250
2 Slacker007 240
3 Sergey Alexandrovich Kryukov 219
4 Ron Beyer 190
0 Sergey Alexandrovich Kryukov 8,743
1 OriginalGriff 7,124
2 CPallini 3,678
3 Rohan Leuva 3,011
4 Maciej Los 2,403


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 12 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid