Page 1 of 1

[Solved] New database

Posted: Tue Feb 21, 2017 10:56 pm
by watmanh
i created a database and a table but could not add data. created a form for the table but still could not add data. database, table and form all show in respective windows. what am I missing?

Re: New database

Posted: Wed Feb 22, 2017 7:07 am
by UnklDonald418
Does your table have a Primary Key that Auto Increments?

Re: New database

Posted: Wed Feb 22, 2017 2:36 pm
by watmanh
i dont have a primary key. will try to figure out how to add one or redo it since it is a small table and no data will be lost for sure

Re: New database

Posted: Wed Feb 22, 2017 4:37 pm
by UnklDonald418
Spreadsheets use Row numbers to differentiate data rows.
Databases require a unique Primary Key in order to differentiate the data rows.
Go to Tools->SQL and edit and enter the following SQL command

Code: Select all

ALTER TABLE "YourTableName" ALTER COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY;
it will add a proper Primary Key to your table.

Re: New database

Posted: Wed Feb 22, 2017 4:59 pm
by watmanh
got status msg

1: Primary key not allowed in statement [ALTER TABLE "track" ALTER COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY]

Re: New database Solved

Posted: Wed Feb 22, 2017 5:05 pm
by watmanh
thank you, had to redo the id field.

Re: New database

Posted: Wed Feb 22, 2017 5:10 pm
by watmanh
i was successful in adding a key but thought problem solved before i tried to enter data. forms created for table dont let me add row

Re: New database

Posted: Wed Feb 22, 2017 5:39 pm
by UnklDonald418
The Primary Key must be on your form. If you don't want to see the Primany Key while entering data on your form you can hide it.

Re: New database solved

Posted: Wed Feb 22, 2017 6:39 pm
by watmanh
thanks much