Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Display repeated value in report from database Post Reply Post New Topic
Author Message
pulak chetia
Newbie
Newbie
Avatar

Joined: 15 Sep 2008
Location: India
Online Status: Offline
Posts: 2
Quote pulak chetia Replybullet Topic: Display repeated value in report from database
     Posted: 15 Sep 2008 at 10:16pm
Hi all ,i am using visual studio 2005 and the language is c# and the database is sql server 2005.I am trying to generate a report of a contractor experience.For this i have two table 1.Contractorinfo 2.WorkExp. For one contractor he may have more than one experience. But in my report only one experience is display against the contractor what i have to do.
i want to displa like this:


Name         amount               year                          dept                       scheme

arun          120000                2008                         phed                      new
arun          130000                2008                          mehd                     new
pulak
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 16 Sep 2008 at 12:44am
Hi,
 
How are you joining the tables..........if inner join then it will extract matching records do you have multiple entries in you workexp table related to contractorinfo......
 
can you paste some sample records and how are u joining .....
 
cheers
Rahul


Edited by rahulwalawalkar - 16 Sep 2008 at 12:45am
IP IP Logged
pulak chetia
Newbie
Newbie
Avatar

Joined: 15 Sep 2008
Location: India
Online Status: Offline
Posts: 2
Quote pulak chetia Replybullet Posted: 16 Sep 2008 at 12:55am
i have not joined the tables.Yes i have multiple records i workexp table related to contractorinfo:


protected void Page_Load(object sender, EventArgs e)
    {
        CrystalDecisions.Shared.ConnectionInfo ConInfo = new CrystalDecisions.Shared.ConnectionInfo();
        ConInfo.UserID = "sa";
        ConInfo.Password = "nicnet10";
        ConInfo.ServerName = "(local)";
        ConInfo.DatabaseName = "blankphed";

        if (Session["officetype"].ToString().Trim().Length < 1)
        {
            Response.Redirect("WorkExperience.aspx");
        }
        if (Session["officename"].ToString().Trim().Length< 1)
        {
            Response.Redirect("WorkExperience.aspx");

        }
       // if (Convert.ToInt32(Session["contractor"].ToString().Trim()) < 1)
        //{
        //    Response.Redirect("WorkExperience.aspx");
       // }

        string officetype =(string)Session["officetype"];
        string officename = (string)Session["officename"];
        int contractor = Convert.ToInt32(Session["contractor"]);     
        DAMASTER = new SqlDataAdapter("select * from ContractorWorkExp", myConnection);
        DSMaster = new DataSet();
        DAMASTER.Fill(DSMaster, "Table");
        if (DSMaster.Tables[1].Rows.Count > 0)
           {
            string cond = "contractorid='" + contractor + "'";
            udr = trm.get_db_table_colVal("ContractorWorkExp", "contractorid", cond,udr);
            if (udr.read())
               {
                rptacc = new CrystalReport();
                string mypath = System.AppDomain.CurrentDomain.BaseDirectory;
                mypath = mypath + "CrystalReport.rpt";
                rptacc.str = mypath;
                rptacc.SetDataSource(DSMaster);
                //rptacc.DataDefinition.GroupSelectionFormula = "{Contractorinfo.contractorid} = " + contractor + "";
                CrystalReportViewer1.ReportSource = rptacc;
                SetDBLogonForReport(ConInfo);
                CrystalReportViewer1.Visible = true;
                CrystalReportViewer1.HasSearchButton = false;
                CrystalReportViewer1.HasViewList = false;
                CrystalReportViewer1.Visible = true;
                Session["contractor"] = null;
                              
              }
            else
            {
                lblerror.Visible = true;
                lblerror.Text = "No Record Found!";
           

            }
        }
        else
        {
            lblerror.Visible = true;
            lblerror.Text = "No Record Found!";
          
        } 
    }


Edited by pulak chetia - 16 Sep 2008 at 12:58am
pulak
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum