I am creating crystal report in ASP.NET and C#.I am creating a crystal report.All are going fine if I give textbox for search parameter but when I give combobox for search parameter then it does not generate report.Data does not come into DATATABLE.Where I am doing wrong?

sql = "select Fund_Allocation.ProjectID,Fund_Allocation.HeadType,Fund_Allocation.GroupName,Fund_Allocation.SubGroupName,Fund_Allocation.Name,Fund_Allocation.FundID,sum(DISTINCT(Fund_Allocation.amt)) as total,sum(DISTINCT(File_Sanction.FundAllocated))as Booked,sum(DISTINCT(File_Purchase.BillAmt))as Expenditure from Fund_Allocation LEFT JOIN File_Sanction on Fund_Allocation.FundID=File_Sanction.FundID left join File_Purchase on Fund_Allocation.FundID=File_Purchase.FundID where Fund_Allocation.ProjectID = '" + ComboBox2.Text + "' AND Fund_Allocation.FinacialYear='" + ComboBox1.Text + "' AND Fund_Allocation.HeadType='" + ComboBox3.Text + "' AND (File_Sanction.SanctionDate>='" + TextBox4.Text + "' AND File_Sanction.SanctionDate<='" + TextBox5.Text + "' or File_Purchase.BillSubmissionDate>='" + TextBox6.Text + "' AND File_Purchase.BillSubmissionDate<='" + TextBox7.Text + "') group by Fund_Allocation.ProjectID,Fund_Allocation.FundID,File_Sanction.FundID,Fund_Allocation.HeadType,Fund_Allocation.GroupName,Fund_Allocation.SubGroupName,Fund_Allocation.Name,File_Purchase.ProjectID,File_Sanction.ProjectID";
            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
            DataSet3 ds = new DataSet3();


            CrystalReport4 objRpt = new CrystalReport4();
            CrystalReportViewer1.ReportSource = objRpt;

Recommended Answers

All 2 Replies

plz help me....its urgent for me

Member Avatar

Seems like your Final Year project huh !!
Well first of all use parametrized query . . coz your code is pretty scary.

And second be specific with your query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.