Crystal Report, solution -- the prompt "the report you requested requires more information" is displayed .")

Source: Internet
Author: User
String SQL = "select * from orders ";
String dbconfig_ SQL = @ "Data Source = WAN-9013A0BB35C \ sql2005; initial catalog = northwind; user id = sa ";
Dataset DS = new dataset ();
Sqlconnection sqlcon = new sqlconnection (dbconfig_ SQL );
Sqlcommand sqlcmd = new sqlcommand (SQL, sqlcon );
Sqldataadapter sqglad = new sqldataadapter ();

Sqglad. selectcommand = sqlcmd;
Sqglad. Fill (DS, "orders ");

Crystalreportsource1.reportdocument. Load (server. mappath ("crystalreport. rpt "));
// Note that the name of the table in dataset must be specified here. Otherwise, the system prompts "the report you requested requires more information ."
Crystalreportsource1.reportdocument. setdatasource (Ds. Tables ["orders"]);
//{?} You do not need to assign values to parameters in, even if a value is assigned.
Crystalreportsource1.reportdocument. parameterfields ["parm"]. currentvalues. addvalue ("1234567 ");
Crystalreportsource1.reportdocument. parameterfields ["title"]. currentvalues. addvalue ("sample report in Push mode! ");
Crystalreportsource1.databind ();

Crystalreportviewer1.reportsource = crystalreportsource1;
Crystalreportviewer1.databind ();

Summary:

Connect to the database, SQL string, or write a stored procedure by yourself.
Fill Dataset
Report viewer obtains reportdocument objects and extracts data from reports.
Pass dataset data to the Report Engine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.