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. Help Please

Help Please

Scheduled Pinned Locked Moved Database
databasehelptutorial
6 Posts 2 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.
  • Y Offline
    Y Offline
    yasso_115
    wrote on last edited by
    #1

    I am inserting Data from one form into two linked tables but i don't know the sql syntax for such a query, plz send me an example.

    yasso

    A 1 Reply Last reply
    0
    • Y yasso_115

      I am inserting Data from one form into two linked tables but i don't know the sql syntax for such a query, plz send me an example.

      yasso

      A Offline
      A Offline
      Arun Immanuel
      wrote on last edited by
      #2

      Please explain clearly what you need.:confused::confused::confused:

      Regards, Arun Kumar.A

      Y 1 Reply Last reply
      0
      • A Arun Immanuel

        Please explain clearly what you need.:confused::confused::confused:

        Regards, Arun Kumar.A

        Y Offline
        Y Offline
        yasso_115
        wrote on last edited by
        #3

        Hi Arun thnx for being interested. As i told u i want the SQL insert query syntax to insert data into two linked tables. lets say this is the syntax to insert data into one table INSERT INTO TABLE1(column1, column2) VAlUES (x, y) whats is the syntax to insert data into two linked tables or more. thanx for ur help

        yasso

        A 1 Reply Last reply
        0
        • Y yasso_115

          Hi Arun thnx for being interested. As i told u i want the SQL insert query syntax to insert data into two linked tables. lets say this is the syntax to insert data into one table INSERT INTO TABLE1(column1, column2) VAlUES (x, y) whats is the syntax to insert data into two linked tables or more. thanx for ur help

          yasso

          A Offline
          A Offline
          Arun Immanuel
          wrote on last edited by
          #4

          Why can't you use 2 separate insert statements?

          Regards, Arun Kumar.A

          Y 1 Reply Last reply
          0
          • A Arun Immanuel

            Why can't you use 2 separate insert statements?

            Regards, Arun Kumar.A

            Y Offline
            Y Offline
            yasso_115
            wrote on last edited by
            #5

            i used them but its gave a syntax error. Look this is what am going to do: I am inserting data from one form into two linked tables "Student" and "Grade" linked together by the Grade_ID column which is a primary key in the Grade table and a forgien key in the Student table. After i insert the data i go to the database to see that the primary key in the Grade table is inserted and its ok but the forgien key in the student table is still null. How can i link them together so that the forgien key in the Student table can take the same value as that in the grade table.

            yasso

            A 1 Reply Last reply
            0
            • Y yasso_115

              i used them but its gave a syntax error. Look this is what am going to do: I am inserting data from one form into two linked tables "Student" and "Grade" linked together by the Grade_ID column which is a primary key in the Grade table and a forgien key in the Student table. After i insert the data i go to the database to see that the primary key in the Grade table is inserted and its ok but the forgien key in the student table is still null. How can i link them together so that the forgien key in the Student table can take the same value as that in the grade table.

              yasso

              A Offline
              A Offline
              Arun Immanuel
              wrote on last edited by
              #6

              How can you say that the foreign key column will be updated automatically when the primary key column is updated? I think you have to use two insert statements like: insert into Student(GradeID,OthercolumnName) values(GradeValue,OthercolumnValue) insert into Grade(GradeID,OthercolumnName) values(GradeValue,OthercolumnValue).

              Regards, Arun Kumar.A

              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