Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
QuestionUpdate progress bar from a separate project Pin
snorkie7-Jun-06 8:34
professionalsnorkie7-Jun-06 8:34 
AnswerRe: Update progress bar from a separate project Pin
Stefan Troschuetz7-Jun-06 10:01
Stefan Troschuetz7-Jun-06 10:01 
QuestionAborting / Killing Threads Pin
MrEyes7-Jun-06 8:08
MrEyes7-Jun-06 8:08 
AnswerRe: Aborting / Killing Threads Pin
Ed.Poore7-Jun-06 10:45
Ed.Poore7-Jun-06 10:45 
QuestionMDI form child closing [modified] Pin
ak877-Jun-06 6:51
ak877-Jun-06 6:51 
AnswerRe: MDI form child closing [modified] Pin
Josh Smith7-Jun-06 9:16
Josh Smith7-Jun-06 9:16 
QuestionConstraints [modified] Pin
kjosh7-Jun-06 6:48
kjosh7-Jun-06 6:48 
AnswerRe: Constraints Pin
dreynglar8-Jun-06 7:05
dreynglar8-Jun-06 7:05 
I am a little confused by your problem statement versus what your code is attempting to do - the problem statement makes no mention of "custid" and given the names of the tables you mention, Author and Article, I'm not sure where a customer would fit in the picture.

Nevertheless, I've put my interpretation of the tables you are working with below (please note that I didn't try very hard to get the PL/SQL statements correct, but they should get my idea across (and you may have different types associated with your column definitions, but the concepts should still work)

CREATE TABLE Author
(
AuthorID INTEGER
FirstName VARCHAR(32)
LastName VARCHAR(32)
)

ADD PRIMARY_KEY CONSTRAINT PK_Author ON Author.AuthorID

CREATE TABLE Article
(
ArticleID INTEGER
AuthorID INTEGER
ArticleName VARCHAR(128)
PublishDate DATETIME
)

ADD PRIMARY_KEY CONSTRAINT PK_Article ON Article.ArticleID
ADD FOREIGN_KEY CONSTRAINT FK_Author Article.AuthorID ON Author.AuthorID

(please rememeber the SQL above is probably wrong!)

If the tables are defined as I have assumed, then you are absolutely right and you should not be getting a primary key violation. But, I do wonder if you made Article.AuthorID the foreign key into the Author table AND the primary key in the Article table. If you did that, then you should indeed get a primary key violation when attempting to add records to the Article table.

Hope this helps a bit...

/dave

----------


If you always do what you always done, you'll always get what you've always got - Anonymous
QuestionC#/SQL Question Pin
leckey7-Jun-06 6:27
leckey7-Jun-06 6:27 
AnswerRe: C#/SQL Question Pin
NaNg152417-Jun-06 6:50
NaNg152417-Jun-06 6:50 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:13
Colin Angus Mackay7-Jun-06 8:13 
AnswerRe: C#/SQL Question Pin
Gerald Schwab7-Jun-06 6:53
Gerald Schwab7-Jun-06 6:53 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:14
Colin Angus Mackay7-Jun-06 8:14 
GeneralRe: C#/SQL Question Pin
Gerald Schwab9-Jun-06 7:07
Gerald Schwab9-Jun-06 7:07 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay9-Jun-06 11:20
Colin Angus Mackay9-Jun-06 11:20 
AnswerRe: C#/SQL Question Pin
malikjhangirahmed@hotmail.com7-Jun-06 7:21
malikjhangirahmed@hotmail.com7-Jun-06 7:21 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:14
Colin Angus Mackay7-Jun-06 8:14 
AnswerRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:11
Colin Angus Mackay7-Jun-06 8:11 
QuestionRe: C#/SQL Question Pin
leckey7-Jun-06 8:15
leckey7-Jun-06 8:15 
AnswerRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 8:29
Colin Angus Mackay7-Jun-06 8:29 
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 8:36
leckey7-Jun-06 8:36 
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 8:55
leckey7-Jun-06 8:55 
GeneralRe: C#/SQL Question Pin
Josh Smith7-Jun-06 9:01
Josh Smith7-Jun-06 9:01 
GeneralRe: C#/SQL Question Pin
Colin Angus Mackay7-Jun-06 9:03
Colin Angus Mackay7-Jun-06 9:03 
GeneralRe: C#/SQL Question Pin
leckey7-Jun-06 9:16
leckey7-Jun-06 9:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.