View previous topic :: View next topic |
Author |
Message |
FredBlogs Blue Pill
Joined: Aug 29, 2006 Posts: 3
|
Posted: Tue Sep 05, 2006 7:25 pm Post subject: Neooffice 2.0 Database Relationships |
|
When I try making a relationship between two databases i get the following error:
Error while connecting to the data source
Primary or unique constraint required on main table: "Bacchus wine club customers" in statement [ALTER TABLE "Collections" ADD FORIEGN KEY ("Type") REFERENCES "Bacchus Wine Club Customers" ("Item")]
I checked the neoOffice help files the closest thing i can find help on adding a foreign key is the primary key topic
Any help would be appreciated |
|
Back to top |
|
|
valterb The Anomaly (earlier version)
Joined: Sep 23, 2005 Posts: 463 Location: San Giuliano Terme, Pisa, Italy
|
Posted: Tue Sep 05, 2006 10:41 pm Post subject: |
|
Well, it seems that you haven't create a primary key in your tables. Try to create it (I think you need a primary keys in both tables), and have a look at what happen.
To do that go in table design mode (select your table, ctrl-click and choose edit). On the left of the table choose one of the row that contains unique data (for this reason is possible that you have created an ID field) and ctrl-click on it. Choose primary key. Save your table and go to create the relationship.
Valter |
|
Back to top |
|
|
amayze The Merovingian
Joined: Oct 24, 2005 Posts: 561 Location: Edinburgh, Scotland
|
Posted: Wed Sep 06, 2006 1:59 am Post subject: |
|
For a quick (and rough) guide to setting up tables with relationships take a look at this post.
Andy. |
|
Back to top |
|
|
FredBlogs Blue Pill
Joined: Aug 29, 2006 Posts: 3
|
Posted: Wed Sep 06, 2006 2:44 am Post subject: |
|
both tables have primary keys and it still keeps giving me the error |
|
Back to top |
|
|
valterb The Anomaly (earlier version)
Joined: Sep 23, 2005 Posts: 463 Location: San Giuliano Terme, Pisa, Italy
|
Posted: Wed Sep 06, 2006 5:20 am Post subject: |
|
So if the problem is not primary key is "unique constraint".
Try to do this. Go to Tool -> SQL.
Than type a command to add a constraint. The command should be something like
Code: | ALTER TABLE "Name OfYourTable" ADD CONSTRAINT unq_signup UNIQUE ("FieldsNamesSeparatedByComma") |
Valter |
|
Back to top |
|
|
|