Custom PK Not Working On Post (New/Edit)

Custom PK Not Working On Post (New/Edit)

brewdevbrewdev Posts: 15Questions: 2Answers: 0

I am using the following VB.NET server code to indicate a custom primary key (i.e., one that is not named the default "ID").

This works fine on GET operations, but fails on POST.
The error message in the response on POST is the familiar
"Invalid column name 'ID'."
which makes it looks like it is not recognizing that I indicated "JudgeID" in the optional 3rd parameter of the constructor.

            Using db = New Database("sqlserver", GetEventConnectionString(DatabaseName))
                    Dim response = New Editor(db, "Judges", "JudgeID") _
                    .Model(Of Judge)() _
                    .Field(New Field("JudgeID").Set(False)) _
                    .Field(New Field("CompetitionID").Set(False)) _
                    .Field(New Field("FirstName")) _
                    .Field(New Field("LastName")) _
                    ....

I cannot add a record (New) or edit an existing. I can see that HttpContext.Current.Request.Form contains an element properly called "JudgeID" so how is it getting confused with the default "ID" again?

Replies

  • brewdevbrewdev Posts: 15Questions: 2Answers: 0
    edited April 2020

    I think I'll have to retract this question. I have an apparent disparity in SQL Server versions or something else going on. (IOW, I have this working fine on production but not on dev).

    Please disregard (unless I reply again).

This discussion has been closed.