954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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)

yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

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

yousafc#
Junior Poster in Training
82 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: