The issues are many. First and foremost, I have a very simple single table lookup that is used, specifically for lookups. It consist of a few fields. SQL below.
Code: Select all
-- Table: pin -- DROP TABLE pin; CREATE TABLE pin ( pinid int4 NOT NULL DEFAULT nextval('pin_pinid_seq'::text), date date NOT NULL DEFAULT '0001-01-01', pin varchar(25) NOT NULL, identity text, CONSTRAINT pin_pkey PRIMARY KEY (pinid) ) WITH OIDS; ALTER TABLE pin OWNER TO lookup; -- Index: pin_idx -- DROP INDEX pin_idx; CREATE INDEX pin_idx ON pin USING btree (pin);
The first issue is that when I create a new table adapter in Visual Studio it does not create the UPDATE or DELETE codes which would be correct if we did not have a Primary Key. We do, however, so this is not the correct behavior. I have added and removed and re-configured the adapter many times and the required methods are not created. The only clue is that when I tell the TableAdapter and Dataset to make INSERT/UPDATE/DELETE commands I get this unusual error:
Configure TableAdapter Pin failed:
ERROR: Attribute "indnatts" not found.
As frustrating as this is, I am able to get around the issue by actually overriding and creating the UPDATE and DELETE commands in a partial class just as if the designer would have created them. The code is not at all difficult. However, in the main class for this TableAdapter the UPDATE (not DELETE) command is created in 4 versions, all of which return a NULL tableAdapter. Very strange indeed.
Now, having gotten past this issue by creating my own overrides, one issue remains. Whenever I go to UPDATE a record on the PIN table, my UPDATE works with the exception of changing the pin to a new pin (note, I did not say pinid to a new pinid as this is the primary key. Pin is not.)
When I check my code, it is because although the tableAdapters RowState is Update for changing any other field, when I want to update the users pin to a new pin, the RowState is Added, not Update. This only occurs for updating PIN, no other field.
Admittedly I am not an experienced PostgreSQL user, however, the TableAdpater side of things, should know that updating a pin from one value to another is an UPDATE, not a new ROW.
Is there anyone that can help with any of these issues? Any ideas? For now I am making more and more kludgey code to fix this CoreLabs adapter which does not at all seem to be complete or fully working.
Software Engineer V