Invalid column name 'id' error in simple join use case
Invalid column name 'id' error in simple join use case
I'm using the editor and trying to get the simple use case of a dropdown populated from a 2nd table to work (this example: https://editor.datatables.net/examples/simple/join.html).
It works fine when I use the sample code, but what I've found is I get an error: Invalid column name 'id'. whenever my primary key of the main table is not named "id". I have an existing table with a primary key of LineItemID and if I rename it to id, all is well, but if I don't, I get the error. The foreign key can be named something else and no problem (mine is MaterialID). But the moment I use a primary key with a name other than id on the main table, I get that error message! Of course the primary key is not used in the data access logic at all, so I'm at a loss of how to fix this.
This question has an accepted answers - jump to answer
Answers
So found out my error. The constructor has a default parameter for the primary key of id, so if your primary key isn't named "id", you have to specify it in the constructor (or use the PKey() method to set)
Hi,
Good to hear you got it sorted out. You can also use the optional third parameter of the constructor to specify the primary key name.
Allan
comes down to RTFM