I was trying to make reports of Chart Of Accounts in ASP.net using Code first approach and RDLC. I got the following error (bunch of same error for different models)
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'AccountCodesAssign'. Previously found CLR type 'FYP.Models.AccountCodesAssign', newly found CLR type 'FYP.Edmx.AccountCodesAssign'.
The schema specified is not valid in other words. What I did was that I included the EDMX file of my database into my project, made the DataSet from it and designed an RDLC report.
I used the following code in ReportViewer.aspx.cs file:
protected void Page_Load(object sender, EventArgs e)
{
PopulateReportData();
}
private void PopulateReportData() {
List<FYP.Edmx.COA_CtrlCode> ctrl = null;
using (FYPEntities db = new FYPEntities()) {
ctrl = db.COA_CtrlCode.ToList();
}
ReportViwer1.LocalReport.DataSources.Clear();
ReportDataSource rd = new ReportDataSource("DataSetca", ctrl);
ReportViwer1.LocalReport.DataSources.Add(rd);
ReportViwer1.LocalReport.Refresh();
}
Please help if you can...
Aucun commentaire:
Enregistrer un commentaire