asp.net Crystal Report-principal-subordinate table correlation problem

Source: Internet
Author: User
Asp.net| Crystal Report | problem

One, use view meeting to integrate multiple table associations

II. filtering data through SQL statements

Third, the establishment and the Master-Slave Table Association

Note that when inserting a subreport in the CrystalReport1 table, it is important to set the associated field of the master-slave table, otherwise it will be out of order.

The main code is as follows:

<summary>
Bind Crystalreport
</summary>
<param name= "STRs" >sql</param>
private void Bdreport (String strs)
{
OCR = new CrystalReport1 ();
SqlConnection cnn = new SqlConnection (configurationsettings.appsettings["Connectionsqlserver"));

SqlDataAdapter cmd1 = new SqlDataAdapter (STRS,CNN);

Create and fill the DataSet.

DataSet2 ds = new DataSet2 ();
Cmd1. Fill (DS, "Meeting");

SqlDataAdapter cmd2 = new SqlDataAdapter ("select * from Realplan where Rplanid to" (select top 10000 planid from ("+sqls Tr+ ") as a order by Planid)", CNN);
SqlDataAdapter cmd2 = new SqlDataAdapter (Sqlisoper, CNN);

Cmd2. Fill (ds, "Realplan");

Create the relation between the Authors and Titles tables.
Ds. Relations.Add ("Mo",
Ds. tables["Meeting". columns["Planid"],
Ds. tables["Realplan"]. columns["Rplanid"]);

Binding ReportViewer
Ocr.setdatasource (DS);

This. Crystalreportviewer1.reportsource = OCR;

Close the connection.
Cnn. Close ();

}







Related Article

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.