[Solved] New database

Discuss the database features

[Solved] New database

Postby watmanh » Tue Feb 21, 2017 10:56 pm

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?
Last edited by watmanh on Wed Feb 22, 2017 6:39 pm, edited 3 times in total.
open office 4.1.3 on windows 10
watmanh
 
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Postby UnklDonald418 » Wed Feb 22, 2017 7:07 am

Does your table have a Primary Key that Auto Increments?
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1236
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: New database

Postby watmanh » Wed Feb 22, 2017 2:36 pm

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
open office 4.1.3 on windows 10
watmanh
 
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Postby UnklDonald418 » Wed Feb 22, 2017 4:37 pm

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   Expand viewCollapse view
ALTER TABLE "YourTableName" ALTER COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY;

it will add a proper Primary Key to your table.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1236
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: New database

Postby watmanh » Wed Feb 22, 2017 4:59 pm

got status msg

1: Primary key not allowed in statement [ALTER TABLE "track" ALTER COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY]
open office 4.1.3 on windows 10
watmanh
 
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database Solved

Postby watmanh » Wed Feb 22, 2017 5:05 pm

thank you, had to redo the id field.
open office 4.1.3 on windows 10
watmanh
 
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Postby watmanh » Wed Feb 22, 2017 5:10 pm

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
open office 4.1.3 on windows 10
watmanh
 
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm

Re: New database

Postby UnklDonald418 » Wed Feb 22, 2017 5:39 pm

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.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1236
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: New database solved

Postby watmanh » Wed Feb 22, 2017 6:39 pm

thanks much
open office 4.1.3 on windows 10
watmanh
 
Posts: 6
Joined: Tue Feb 21, 2017 10:53 pm


Return to Base

Who is online

Users browsing this forum: No registered users and 7 guests