Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Still Struggling & Need Assistance
Message
Information générale
Forum:
ASP.NET
Catégorie:
Rapports
Divers
Thread ID:
01504280
Message ID:
01504286
Vues:
81
1st: What was the name of the dataset and datatable you used when you created the report? Make sure the datatable name matches in your dynamic datatables created when running via code. don't pass table[0], pass the datatable name like my_datatable or my_dt (whatever it was when you created the report (always in design mode save your datatable with a name that you can pass later - the datasource in runtime mode can then be almost any datasource with a source name and contains column names and types that match.)

2nd: Check and see if there is any data (still should not produce the error you see though)
            if (dsProjectInfo.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("No data Found", "CrystalReportMissingData");
                return;
            }
Just to be clear: reportObj.SetDataSource(dsProjectInfo.Tables[0]) cannot work.

reportObj.SetDataSource(dsProjectInfo.MyDataTable) would work if when you designed the crystal report you used a datatable named "MyDataTable" as the datasource in design mode.

In design mode, what was the name of the dataset and datatable you used? Just make sure the names match in code (and the result columns match as well) . The datatable's name must match that in the schema file used by the report.

It's been a couple of years since I've worked with Crystal Reports in .net, but I'm pretty sure those rules haven't changed...

When you create a dataset and datatable(s) in the designer, save the datatable with a name that makes sense to you according to the report and the data you are using. Then use the same name when you create the datatable in code programmatically and pass it with that name in code.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform