locked
Generating report off record table adapter not finding data but the mvc project does. RRS feed

  • Question

  • User-544325736 posted

    Hello community,

    I have an MVC project that is trying to print reports. I have a .rdlc report that is showing information. I also have my project using entity framework. I am currently trying to get a generated report on specific records that are picked. I have all the records from the db in my project working fine and they can select them but when I am calling the method with the tableadapter to generate the report its getting null. It brings me to the model.edmx dataset designer and where the connection says  

    if ((this._connection == null)) {
                        this.InitConnection(); the object is null. 
    Here is the part of the code where the tableadapter is doing the method.
    public List<requiredReportListElements> getReportListInfo(List<findPartNumberListAttributes> current)
            {
                /* Database for Version 1.x.x Adept AMAZON [was 'db'] */
                PartNumberDataSet dataSet = new PartNumberDataSet();
                PartNumberDataSetTableAdapters.EverythingForReportTableAdapter tableAdapter = new PartNumberDataSetTableAdapters.EverythingForReportTableAdapter();
    
                /* Database for Version 2.x.x  TRACKER_TEST*/
                //TRACKER_TESTDataSet dataSet = new TRACKER_TESTDataSet();
                //TRACKER_TESTDataSetTableAdapters.EverythingForReportTableAdapter tableAdapter = new TRACKER_TESTDataSetTableAdapters.EverythingForReportTableAdapter();
    
    
                List<requiredReportListElements> allParts = new List<requiredReportListElements>();
    
                foreach (var element in current)
                {
                    tableAdapter.FillBy(dataSet.EverythingForReport, element.partNumber);
                    //var somethin = tableAdapter.GetDataBy(element.partNumber);
                    var part = (from n in dataSet.EverythingForReport//somethin//
                                select new requiredReportListElements
    public ActionResult purchasePartReport(string command, FindPartModel list)
            {
                /* Database Amazon Adept V2 */
    
                AmazonPartNumberDataSet db = new AmazonPartNumberDataSet();
                AmazonPartNumberDataSetTableAdapters.EverythingForReportTableAdapter tb = new AmazonPartNumberDataSetTableAdapters.EverythingForReportTableAdapter();
                LocalReport localReport = new LocalReport();
                localReport.ReportPath = Server.MapPath("~/ReportForms/purchasePartReport.rdlc");
                List<AmazonPartNumberDataSet.EverythingForReportRow> report = new List<AmazonPartNumberDataSet.EverythingForReportRow>();
                foreach (var item in list.requiredOnReportList)
                {
                    report.AddRange(tb.GetDataBy(item.partNumber).ToList());
                }
                ReportDataSource rds = new ReportDataSource("EverythingForReports", report);
                localReport.DataSources.Add(rds);
    

    Thursday, August 1, 2019 1:26 PM

All replies

  • User-1174608757 posted

    Hi ExceedingLife,

    It brings me to the model.edmx dataset designer and where the connection says

    According to your description,I couldn't understand  what this sentence means. Could you please explain about the detail of this situation?

    Best Regards

    Wei

    Monday, August 5, 2019 6:42 AM