[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how to get parameter fields from ASP .NET to CR

Posted on 2004-11-01
9
Medium Priority
?
765 Views
Last Modified: 2012-08-13
Hi all,
I am writing a ASP .NET program (C#) to view a CR (8.5), and the CR takes a fews parameter fields, how can I use C# API to pass the parameter fields to CR to output the report?

one  more question is, when I view the CR (directly), it will prompt for sql connection username and password, I have made  a  file dsn for the connection, and it prompt out for these info everytime I view the report, can I pass these fields by using ASP.NET API too? Thanks a lot!
0
Comment
Question by:ultrafish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 1

Accepted Solution

by:
Sevnn earned 500 total points
ID: 12467403
// Create report instance
private ReportDocument reportDocument = new ReportDocument();

// Assign values to instance
reportDocument.Load(strLocation);  // location of report
reportDocument.SetDatabaseLogon(dbUser,dbPass); // username and password for DB access

// Assign parameters to report
reportDocument.SetParameterValue(paramName,paramValue);
reportDocument.SetParameterValue(paramName,paramValue);
reportDocument.SetParameterValue(paramName,paramValue);

You didn't mention what you want to do with the report.  Your options are to sent it to a viewer, export or print.

// Print
reportDocument.PrintOptions.PrinterName = printerName;
reportDocument.PrintToPrinter(1, false, 0, 0);

// Export - This will require export options to be defined.
reportDocument.Export();






0
 

Author Comment

by:ultrafish
ID: 12468002
if I have to choose the datasource like
data.dsn
how can I choose it?
thanks~~~
0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 

Author Comment

by:ultrafish
ID: 12468050
also, I cannot find the method SetDatabaseLogon and SetParameterValue method
which library has to be imported?

and if I want to print directly, how can I do that? thanks
0
 
LVL 1

Expert Comment

by:Sevnn
ID: 12468074
I have never needed to choose a dsn.  I did a quick check and ReportDocument has a parameter:

reportDocument.SetDataSource(dsnSource);

Hope this helps.  Thanks for the points ultrafish, this is my first accepted response (also my first day to be a member of EE).  Good Luck.
0
 
LVL 1

Expert Comment

by:Sevnn
ID: 12468127
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

Is "reportDocument" working at all for you?

What do you mean by printing directly?
0
 

Author Comment

by:ultrafish
ID: 12468788
is that only exist in 2003 and CR 9.0?
I am using CR 8.5 and VS.NET 2002 only, I don't have the method SetDatabaseLogon() and SetParameterValue()
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 12469857
0
 
LVL 1

Expert Comment

by:Sevnn
ID: 12474025
Ahhh, You weren't specific about your .Net development environment.  You referenced CR 8.5 but I understand that as a reference to what version the reports were originally written in.  I don't know if CR 8.5 components in 2002 would be similar to the code I posted.  What I posted is from a working program in .Net 2003 with CR 9.0 (Crystal Decisions).  Hopefully mlmcc's link will provide the information you need.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question