We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,417 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Crystal Reports view problem by Parameter

Hello,This is my code.I have in big problem anyone have a solution. I want view crystal Report by using studentid.

{

                CrystalReport1 objRpt;
                objRpt = new CrystalReport1();
                string con = ("Data source =DATA;Initial Catalog = Schooldata;Integrated security = True");
                SqlConnection objCon = new SqlConnection(con);
                // Here I am writing my query over the view
                // we cannot write query directly over the tables because it will be a 
                // join query and we will not be able to fill our adapter easily.
              string query = "Select StudentName from studentinfo where studentid=22";
                SqlDataAdapter dt = new SqlDataAdapter(query , objCon);
                DataSet1 Ds = new DataSet1();
                
                dt.Fill(Ds ,"studentinfo");

                //dt.Fill(Ds.Studentinfo , Convert.ToInt32(txtstudentid.Text));
             
                   if (Ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("No REcord");
                    return;
                }

                objRpt.SetDataSource(Ds);
                CrystalDecisions.CrystalReports.Engine.TextObject root;
                root = (CrystalDecisions.CrystalReports.Engine.TextObject)
                objRpt.ReportDefinition.ReportObjects["txtHeader"];
                root.Text = "Sample Report With Parameter!!";
                crystalReportViewer1.ReportSource = objRpt;

when I press button Err (No Record found)

1
Contributor
1
Reply
14 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
yousafc#
Junior Poster in Training
98 posts since Feb 2011
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

Any one can help me ?????//

yousafc#
Junior Poster in Training
98 posts since Feb 2011
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0725 seconds using 2.64MB