| |

VerySource

 Forgot password?
 Register
Search
View: 740|Reply: 7

Can the data source of the crystal report use the data in the DataGridView

[Copy link]

2

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-11 09:30:01
| Show all posts |Read mode
There is a DataGridView similar to the one below, where the data is not obtained directly from the database.
Some are calculated (field data is indeterminate).
———————————————————-
| Name | Basic salary | Performance allowance | Total |
| ————————————————————
| Lee | 1000 | 1000 | 2000 |
| ————————————————————
| Wang | 1000 | 1000 | 2000 |
| ————————————————————
| Total | 2000 | 2000 | 4000 |
———————————————————-
Ask how to use crystal reports to carry the data in this DataGridView?
Reply

Use magic Report

0

Threads

26

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-4-7 19:15:01
| Show all posts
The data of the DataGridView is also stored in the DataTable, just bind this DataTable directly
crystalReport1.ReportSource = DataTable;
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-8 15:00:01
| Show all posts
Ok
Reply

Use magic Report

2

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-4-14 22:30:02
| Show all posts
Part of the data is taken from the database, part of the data is calculated, you can not directly use the datatable.
In addition, can DataTable be used directly as a data source for crystal reports?
Reply

Use magic Report

0

Threads

15

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-16 23:45:02
| Show all posts
Both DataSet and DataTable can be used as data sources for crystal reports.

Another: Since you can send data to cr, why can't you send data to a datatable?
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-4-20 19:15:01
| Show all posts
of course.
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-4-21 18:15:01
| Show all posts
Of course. Use the dataset, and directly from the datagridview to construct a new dataset class
Reply

Use magic Report

2

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-7-20 22:00:02
| Show all posts
I have seen many examples of fetching data from a certain table. In this case, the fields are generally fixed.
What I want to achieve is to use datatable as the data source, and the fields in the datatable are not fixed.
My thoughts are as follows:
new a reportdocument
reportdocument.load("... crystalReport.rpt")
reportdocument.setdatasource(....datatable or dataset)
rptViewer.datasource=reportdocument

How to set crystalReport.rpt at this time?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list