Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reflection Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01452083
Message ID:
01452107
Vues:
38
>>>I'm trying to instantiate a Crystal Report class using reflection:
>>>
>>>
>>>private void _SetupReport()
>>>{
>>>    int ReportId = Convert.ToInt32(Session.Contents["ReportId"].ToString());
>>>
>>>    string Command = "SELECT ReportName FROM ApexReports WHERE RecordId = " + ReportId.ToString();
>>>    DataSet dsReportName = DataLayer.ExecuteQuery(Command);
>>>
>>>    string ReportClassName = dsReportName.Tables[0].Rows[0]["ReportName"].ToString();
>>>
>>>    Report = (ReportDocument)Assembly.GetExecutingAssembly().CreateInstance(ReportClassName);
>>>
>>>    CRViewer.ReportSource = Report;
>>>}
>>>
>>>
>>>Report is null when this runs. The vaariable ReportClassName contains the correct name. What am I doing wrong?
>>
>>Assembly.CreateInstance() will only create a type contained within itself. Are you sure that this is the right assembly?
>
>I think so. It's an ASP.Net app and there are only 3 pages and the report. I thought I read somewhere that I needed to include
>the namespace, but I don't see any namespaces in a web app.

There's always a namespace (unless you deliberately removed it). In the ASPX page you can see it in the Inherits attribute of the Page. Or, of course, in rhe aspx.cs file......
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform