Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. regarding foreignkey data

regarding foreignkey data

Scheduled Pinned Locked Moved Database
help
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kheer
    wrote on last edited by
    #1

    I have two tables. both tables have a common column (named=Rank) I have made table1 column(Rank) as primary key I have made table2 column(Rank) as foreign key every thing is working properly problem is when i enter some invalid data in table2(into Rank) which is not there in table1 I want to generate a pop up is this possible thanks in advance

    D 1 Reply Last reply
    0
    • K kheer

      I have two tables. both tables have a common column (named=Rank) I have made table1 column(Rank) as primary key I have made table2 column(Rank) as foreign key every thing is working properly problem is when i enter some invalid data in table2(into Rank) which is not there in table1 I want to generate a pop up is this possible thanks in advance

      D Offline
      D Offline
      dotnetcsharpdev
      wrote on last edited by
      #2

      U can enter only enter those values in table2(Rank) which are present in Primary Key. This is the fundamental of having a foreign key. If you want to add values other than those in primary key remove the constraint.

      K 1 Reply Last reply
      0
      • D dotnetcsharpdev

        U can enter only enter those values in table2(Rank) which are present in Primary Key. This is the fundamental of having a foreign key. If you want to add values other than those in primary key remove the constraint.

        K Offline
        K Offline
        kheer
        wrote on last edited by
        #3

        thats wat i am saying when i enter other values i want to generate an popup message showing error

        D A 2 Replies Last reply
        0
        • K kheer

          thats wat i am saying when i enter other values i want to generate an popup message showing error

          D Offline
          D Offline
          dotnetcsharpdev
          wrote on last edited by
          #4

          If itz in a form, u can trap the error number and popup a window with the message. Use "Try Catch" and popup window in Catch

          1 Reply Last reply
          0
          • K kheer

            thats wat i am saying when i enter other values i want to generate an popup message showing error

            A Offline
            A Offline
            Ashfield
            wrote on last edited by
            #5

            kiranreddy wrote:

            i want to generate an popup message showing error

            You need to do that in your application, there is no such thing in sql.

            Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

            K 1 Reply Last reply
            0
            • A Ashfield

              kiranreddy wrote:

              i want to generate an popup message showing error

              You need to do that in your application, there is no such thing in sql.

              Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

              K Offline
              K Offline
              kheer
              wrote on last edited by
              #6

              ok thanks for ur advice

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups