problem with foreign key

  • Hi everyone

    I am trying insert records in database using Visual basic but it gives error as below

    ERROR:

    ERROR:

    " Insert statement conflicted with clolumnforeign key constraint "fk_import_basic_jobs" . The conflict ocurred in database bayan,table 'jobs', column 'job_code'.

    what could be problem and what is solution.

    Please its very urgent

    Waiting for reply.

    Thanx in advance

  • Step 1:

    Insert the master record in the table bayan.dbo.jobs.

    Step 2:

    Insert the detail record in the child table.

    This would solve your problem.

    Thanks,

    Ganesh

  • The reason you are getting the error is that you need a related record in the "Parent" table before creating the "child" record.  I would recommend doing some reading on relational database design in order to understand it better.

    As Ganesh said, inserting the "parent" record into the jobs table is what you need to do first.

    Andrew

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply