TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dealy
NA
213
0
Loading Crystal Report with parameters - ASP.NET Web forms
Jun 21 2016 2:31 AM
Hello,
I'm trying to load a crystal reports with parameters using a stored procedure as a data source.I'm using Visual Studio 2015 with ASP.NET Web forms.
I've created the report (Report1.rpt) using wizard, binding it on my stored procedure. When I was asked to enter the parameters I left it blank.
Here's my code:
protected
void
Button1_Click(object sender, EventArgs e)
{
ReportDocument reportDocument =
new
ReportDocument();
ParameterField paramField =
new
ParameterField();
ParameterFields paramFields =
new
ParameterFields();
ParameterDiscreteValue paramDiscreteValue =
new
ParameterDiscreteValue();
paramField.Name =
"@id"
;
paramDiscreteValue.Value =
"123"
;
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
string reportPath = Server.MapPath(
"~/User/Report1.rpt"
);
reportDocument.SetDatabaseLogon(
"user"
,
"pass"
,
"SERVER"
,
"DB1"
,
false
);
reportDocument.Load(reportPath);
CrystalReportViewer1.ReportSource = reportDocument;
1. When I click on the button I get nothing. Any ideas why the report is not loading?
2. If i use the following code I get error in "SERVER\TSQL2012"
reportDocument.SetDatabaseLogon(
"user"
,
"pass"
,
"SERVER\TSQL2012
"
,
"DB1"
,
false
);
Any kind of help would be appreciated!
Thank you in advance.
Reply
Answers (
4
)
how can i link google plus and instagram to my wedsite
Visual Studion 2013 Install In windows 7 SP1