Passing parameters from ReportViewer through to stored procedure data source for SSRS report
By : Levi Macedo
Date : March 29 2020, 07:55 AM
it should still fix some issue I would set the report parameters as Internal but read up on this article http://msdn.microsoft.com/en-us/library/aa337234.aspx for the section Hidden and Internal Parameters and decided for yourself what is appropriate to the problem. Assuming you have a stored proc like code :
CREATE PROCEDURE dbo.RepeatAfterMe
(
@inputText varchar(50)
, @repeatFactor int = 10
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @count int
DECLARE @hack TABLE (inputText varchar(50))
SET @count = 0
WHILE @count < @repeatFactor
BEGIN
INSERT INTO @hack SELECT @inputText
SET @count = @count + 1
END
SELECT H.* FROM @hack H
END
GO
@inputText =Parameters!InputText.Value
@repeatFactor =Parameters!RepeatFactor.Value
Microsoft.Reporting.WebForms.ReportParameter[] reportParameters = null;
reportParameters = new Microsoft.Reporting.WebForms.ReportParameter[2];
reportParameters[0] = new Microsoft.Reporting.WebForms.ReportParameter("inputText", txtInput);
reportParameters[1] = new Microsoft.Reporting.WebForms.ReportParameter("repeatFactor", 10);
try
{
rvReportViewer.ServerReport.SetParameters(reportParameters);
}
catch(Microsoft.Reporting.WebForms.ReportServerException ex)
{
Response.Redirect("~/Error.aspx");
}
|
Creating a variable number of nodes on target document without corresponding data on source document
By : VIOO66
Date : March 29 2020, 07:55 AM
Any of those help As pointed out, XSLT can create nodes on the target document at will (I didn't know this and this was the key part). Turns out that what I needed is a simple for-loop in XSLT. Once I realized this, a quick Google search yielded the following results: http://quomon.com/question-How-to-make-a-for-loop-in-xslt-not-for-each-809.aspx code :
<xsl:template name="ForLoop">
<xsl:param name="i" /> <!-- index counter, 1-based, will be incremented with every recursive call -->
<xsl:param name="length" /> <!-- exit loop when i >= length -->
<!-- Output the desired node(s) if we're still looping -->
<!-- The base case is when i > length (in that case, do nothing) -->
<xsl:if test="$i <= $length">
<Filler>
<Padding>999999</Padding>
</Filler>
</xsl:if>
<!-- Call the ForLoop template recursively, incrementing i -->
<xsl:if test="$i <= $length">
<xsl:call-template name="ForLoop">
<xsl:with-param name="i">
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="length">
<xsl:value-of select="$length"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
|
Passing parameters to stored procedure and then using it as data source in SSRS report
By : Krishna Reddy
Date : March 29 2020, 07:55 AM
hope this fix your issue In your Report Builder/BIDS Environment create a new report. Create a datasource which points to your database.
|
A data source instance has not been supplied for the data source 'DataSet2'-SSRS
By : Andrey Lazarov
Date : March 29 2020, 07:55 AM
To fix the issue you can do As per tgolisch instead of table i Bound dataset and passed to report it works fine. And also instead of four separate table i created a view .It Makes my job simple code :
private DataTable getData()
{
DataSet dss = new DataSet();
string sql = "";
sql = "SELECT * from VW_TransReciptReport WHERE tREC_NUPKId='" + TxtID.Text + "'";
SqlDataAdapter da = new SqlDataAdapter(sql, con);
da.Fill(dss);
DataTable dt = dss.Tables[0];
return dt;
}
private void runRptViewer()
{
this.rptviewer.Reset();
ReportParameter rp = new ReportParameter("ID", TxtID.Text.ToString());
this.rptviewer.LocalReport.ReportPath = Server.MapPath("ReportReceipt.rdlc");
rptviewer.LocalReport.SetParameters(new ReportParameter[] { rp });
ReportDataSource rdsB = new ReportDataSource("DataSet1_VW_TransReciptReport", getData());
this.rptviewer.LocalReport.DataSources.Clear();
this.rptviewer.LocalReport.DataSources.Add(rdsB);
this.rptviewer.DataBind();
this.rptviewer.LocalReport.Refresh();
}
|
SSRS date parameters with Oracle data source
By : Phonrob Sawasdee
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I have a ssrs report with oracle data source and two date parameters: startdate and enddate, query like this: , I think you're after: code :
select *
from mytbl
where reportdate between nvl(:startdate, to_date('01/01/1900', 'dd/mm/yyyy')
and nvl(:enddate, to_date('31/12/9999', 'dd/mm/yyyy');
|