Editor from Editor Generator not loading table from db

Editor from Editor Generator not loading table from db

dpanscikdpanscik Posts: 202Questions: 47Answers: 0
edited March 2023 in Free community support

Well this is frustrating. Loading db tables into datatable.net is something I have been doing for several years.

Now that I am trying to learn how to use editor, I cant even get tables to load.

What could be wrong here?

I downloaded a fresh copy from https://editor.datatables.net/generator/

When i refresh the page, i get the following java error message telling me the data didnt make it.

Im getting inside of the controller verified by hitting a break point on line 16.

Here is my controller (stock from the Generator)

            /*
             * Controller for DB table Flex_OnCall
             * Created by http://editor.datatables.net/generator
             */
            using System;
            using System.Collections.Generic;
            using System.Net.Http.Formatting;
            using System.Web;
            using System.Web.Http;
            using DataTables;
            using EditorGenerator.Models;
            
            namespace EditorGenerator.Controllers
            {
                public class Flex_OnCallController : ApiController
                {
                    [Route("api/Flex_OnCall")]
                    [HttpGet]
                    [HttpPost]
                    public IHttpActionResult Flex_OnCall()
                    {
                        var request = HttpContext.Current.Request;
                        var settings = Properties.Settings.Default;
            
                        using (var db = new Database(settings.DbType, settings.DbConnection))
                        {


                            var response = new Editor(db, "Flex_OnCall", "TableID")
                                .Model<Flex_OnCallModel>()
                                .Field(new Field("day")
                                        .Validator(Validation.DateFormat(Format.DATE_ISO_850))
                                        .GetFormatter(Format.DateSqlToFormat(Format.DATE_ISO_850))
                                        .SetFormatter(Format.DateFormatToSql(Format.DATE_ISO_850))
                                )
                                .Process(request)
                                .Data();

                            return Json(response);
                        }
                    }
                }
            }

Here is my SQL connection settings;

Here is a screenshot of SQL Studio showing the data table that was created by the Controller on the first run.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    There appears to be something wrong with the dll available on Nuget in certain cases. If you download the .NET package from the download page, unzip it and load in the dll from there, it should spring into action.

    There was another thread about this issue last week, but I wasn't able to replicate the issue in .NET Framework 4.8. Are you able to tell me how you set your project up (did you use a VS template for example?) and I presume the dll was included from Nuget. What .NET version are you using? Basically anything that could help me reproduce this so I can fix whatever is going wrong!

    Thanks,
    Allan

  • dpanscikdpanscik Posts: 202Questions: 47Answers: 0

    Hi Allan,

    I don't recall how I came to be here. I believe I did a nuget then manually registered the dll. I don't recall for sure the exact workflow to arrive at the present point in time. The trail of bred crumbs is lost for now.

    The dll I am currently using, is for 4.8 and I believe it arrived in the zip package named: Editor-NETFramework-2.1.1.zip

    Can you send me a link either here or in a PM to a 4.8 dll that you consider to be "working". Ill download it and give it a test drive.

    Thanks! DP

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    That's the one I expected to work. This is the other thread that I was thinking about.

    As I mentioned there, I created a new MVC project in VS, with .NET Framework 4.8.

    In that case I used the Nuget and it worked okay - the dll as well.

    As far as I can tell the Nuget dll and the download one are the same so I don't understand why there is a problem, but there obviously is somewhere, and just using the dll from the download doesn't appear to be the answer.

    If you have any ideas for how I can reproduce this error, I'm all ears, as I'd like to get to the bottom of this.

    Allan

  • dpanscikdpanscik Posts: 202Questions: 47Answers: 0

    I think there is a 3rd thread that has this issue that fizzed out early in the conversation.

    The solution/project I am trying to get working is pretty much stock from https://editor.datatables.net/generator/

    Which is a net 4.5 solution/project. I thought it was a 4.8 project but I was mistaken, it is indeed a 4.5.

    That's about all Ive got. If you can think of something you would like for me to try. Let me know.

  • dpanscikdpanscik Posts: 202Questions: 47Answers: 0

    Allan,

    If you want to write a little controller to throw some hooks and traps and tricks into the dll to get a better idea where the problem might be. I would be willing to rack up that controller and get to you the results of the adventure.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    I didn't try it with Generator. I should have thought of that really... I don't have my Windows machine with me today, but I'll try that when I get home. Hopefully (?) it will break!

    Allan

  • dpanscikdpanscik Posts: 202Questions: 47Answers: 0

    10-4 awaiting the results from your romp around with the editor generator.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Just a quick note to say that yes, with Generator I get exactly that error. I'm digging further into it now :)

    Allan

  • dpanscikdpanscik Posts: 202Questions: 47Answers: 0

    Happy to hear that you were able to see the issue with your own eyeballs. Makes it much easier for troubleshooting. Much easier.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Should be good to go now! If you download a fresh build from Generator for .NET Framework it should run without the error you were seeing :)

    Allan

  • dpanscikdpanscik Posts: 202Questions: 47Answers: 0

    I confirm. Samples downloaded form Editor Generator is now working! I now have a working example to move forward with. Very nice.

    One note. When you first open a sample downloaded from Editor Generator, you will have several code errors. Be sure to do a "Build" this will clear out most if not all of the errors.

Sign In or Register to comment.