www.webdeveloper.com
Results 1 to 3 of 3

Thread: 2 select query in 1 report

  1. #1
    Join Date
    Mar 2007
    Posts
    20

    2 select query in 1 report

    i want to use 2 query in 1 report
    i know it is possible to do

    but i dont know hoe to add the 2nd query in the
    dataset

    go thru my code below

    private DataService.BWebService dh = new DataService.BWebService();

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/DataSetOracle", RequestNamespace="http://localhost/", ResponseNamespace="http://localhost/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public System.Data.DataSet DataSetOracle(string SQLStatement) {
    object[] results = this.Invoke("DataSetOracle", new object[] {SQLStatement});
    return ((System.Data.DataSet)(results[0]));


    protected void CountByDesk()
    {
    string ByMonth = ((FrmMain)this.frm1inForm2).cmbMonth2.Text.ToLower();
    string ByYear = ((FrmMain)this.frm1inForm2).cmbYr2.Text;
    string ByDesk = ((FrmMain)this.frm1inForm2).cmbDesk.Text;

    System.Data.DataSet dstData = new System.Data.DataSet();

    dstData = dh.DataSetOracle(vs.getSQL_MonthYearDesk(ByDesk,ByMonth,ByYear));
    >>--IWANT TO CALL ONE MORE SQL HERE(getSQL_ExclusiveNewsByDesk)....HOW AM I GOT TO DO?
    CrystalReport1 cr = new CrystalReport1();

    cr.SetDataSource(dstData.Tables[0]);
    crv.ReportSource = cr;
    }


    public string getSQL_MonthYearDesk(string dsk,string mnth,string yr)
    {
    if (dsk == "General Desk (PBA)"){dsk = "1";}
    else if(dsk == "Crime Desk (PBA)"){dsk = "2";}
    else if(dsk == "Court Desk (PBA)"){dsk = "3";}
    else if(dsk == "Sport Desk (PBA)"){dsk = "4";}
    else if(dsk == "Features Desk (PBA)"){dsk = "5";}
    else if(dsk == "International Desk (PBA)"){dsk = "6";}
    else if(dsk == "Mandarin Desk (PBA)"){dsk = "7";}
    else if(dsk == "Economy Desk (PBE)"){dsk = "8";}
    else if(dsk == "Bskl,Kloffe Desk (SEC)"){dsk = "9";}
    else if(dsk == "Forex,Money Market,Klibor Desk (MME)"){dsk = "10";}
    else if(dsk == "Comodity Desk (CE)"){dsk = "11";}
    else {dsk = "12";}

    string sql = "SELECT DISTINCT(D.DESK_DESC) AS DESK,TO_CHAR(N.CREATE_DATE,'month') AS MONTH, "+
    "TO_CHAR(N.CREATE_DATE,'yyyy')as year "+
    "from u_desk d "+
    "inner join u_user u on u.desk_id = d.desk_id "+
    "inner join n_news n on n.create_id = u.user_id "+
    "where d.desk_id = '"+dsk+"' "+
    "and TO_CHAR(N.CREATE_DATE,'mon')= '"+mnth+"' "+
    "AND TO_CHAR(N.CREATE_DATE,'yyyy')= '"+yr+"' ";

    return sql;
    }

    public string getSQL_ExclusiveNewsByDesk(string dsk,string mnth,string yr)
    {
    string sql = "SELECT U.NAME,COUNT(*) as COUNT "+
    "FROM N_NEWS N "+
    "INNER JOIN U_USER U ON U.USER_ID = N.CREATE_ID "+
    "WHERE U.DESK_ID = '"+dsk+"' and TO_CHAR(N.CREATE_DATE,'mon')= '"+mnth+"' "+
    "AND TO_CHAR(N.CREATE_DATE,'yyyy')= '"+yr+"' GROUP BY NAME";

    return sql;
    }

  2. #2
    Join Date
    Mar 2007
    Posts
    20
    no one can help me?

  3. #3
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    Hi,

    just add another table to your dataset.

    yourdataset.Tables.Add(New DataTable("NewTableName"))

    then fill it in the same way as you did your first table.
    ----------------------------------

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles