or
Dim rptContract As New rptSinglePageContract
Dim rptProcessor As New Telerik.Reporting.Processing.ReportProcessor
Dim Contract() As Byte
rptContract.reportHeader.ConnectionString = GetSQLConnectionString()
rptContract.reportDetails.ConnectionString = GetSQLConnectionString()
rptContract.ReportParameters("ID").Value = m_contract.ID
Contract = rptProcessor.RenderReport("PDF", rptContract, Nothing).DocumentBytes
If printersettings.PrinterName <> "" Then
rptProcessor.PrintReport(rptContract, printersettings)
End If
IO.File.WriteAllBytes(outputcontractfilename, Contract)
When I do a new report and I want to select the source of data using the wizard Telerik Reporting in the drop-down combo there is no data source (connection). I want to create a new connection and the following message when I press the button "Object Reference not Set to an instace of a object"
This problem also occurs when I want to add a new source of data in the contextual menu in the configure option
How can solves this problem? Thanks
public
class
ReportResolver : IReportResolver
{
private
readonly
IReportResolver _parentResolver;
public
ReportResolver(IReportResolver parentResolver)
{
_parentResolver = parentResolver;
}
public
ReportSource Resolve(
string
report)
{
ReportSource reportSource =
null
;
reportSource = GetReportSource(report);
if
(reportSource ==
null
&& _parentResolver !=
null
)
reportSource = _parentResolver.Resolve(report);
return
reportSource;
}
public
ReportSource GetReportSource(
string
report)
{
var settings =
new
XmlReaderSettings {IgnoreWhitespace =
true
};
using
(var xmlReader = XmlReader.Create(@
"d:\repot.trdx"
, settings))
{
var xmlSerializer =
new
ReportXmlSerializer();
var reportDocument = (Report) xmlSerializer.Deserialize(xmlReader);
// Data will be read from database.
reportDocument.DataSource =
new
List<
int
> {1, 2, 3};
var reportSource =
new
InstanceReportSource {ReportDocument = reportDocument};
return
reportSource;
}
}
}
Dim report As New Telerik.Reporting.InstanceReportSource
report.ReportDocument = New ReportHistory
With report.Parameters
.Add("pUserName", Request.Cookies("username").Value)
.Add("pUserID", Request.Cookies("senderid").Value)
.Add("pFromDate", Now.Date.AddDays(-30))
.Add("pToDate", Now.Date)
End With
ReportViewer.ReportSource = report
ReportViewer.RefreshReport()