Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

geting year part from start date in rdlc report

$
0
0

i have a report like below, i want year to be displayed ( for instance, if the report is generated from 1st jan 2014 to  15 july 2014,i want it to be displayed like this

ACTIVITES REPORT - 2014

1st jan 2014 to 17 july 2014

here is my code

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Reporting.WebForms;

public partial class PortActivites : System.Web.UI.Page
{
    public string con =
        ConfigurationManager.ConnectionStrings[
        "ConectionString"].ConnectionString;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {

        ReportViewer1.Visible = true;
        SqlConnection thisConnection = new SqlConnection(con);
        SqlCommand com = new SqlCommand("PortActvitiesFinal", thisConnection);
        com.CommandType = CommandType.StoredProcedure;
        com.Parameters.AddWithValue("@chkDate", txtStartDate.Text);
        com.Parameters.AddWithValue("@EndDate", txtEndDate.Text);


        SqlDataAdapter da = new SqlDataAdapter();
        da.SelectCommand = com;

        DataSet ds = new DataSet();

        thisConnection.Open();
        da.Fill(ds);





        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[0]));
        ReportParameter Sdate = new ReportParameter("StartDate", txtStartDate.Text);
        ReportParameter Edate = new ReportParameter("EndDate", txtEndDate.Text);
        //ReportParameter EYear = new ReportParameter("Year", DateTime.  
          ReportViewer1.LocalReport.SetParameters(Sdate);
          ReportViewer1.LocalReport.SetParameters(Edate);


        if (ds.Tables[0].Rows.Count == 0)
        {

            lblMessage.Text = "Sorry,there isnt";
        }

        ReportViewer1.LocalReport.Refresh();
    }

}


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>