DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: INSERT INTO TABLE BUT NOT IN ORDER

  1. #1
    MAVM Guest

    INSERT INTO TABLE BUT NOT IN ORDER


    ADO 2.1 and ACCESS 2000

    When i insert a few records into more than 1 table, the records are inserted
    in aleatory forms that i can't understand because the records that are inserted
    in the first table, i mean lets say monday the records are inserted at the
    end of the table but in the next tables this records inserted in the middle
    or start of the respective table.

    I HAVE THIS CODE:
    A=50
    For I = 1 To 10
    CnnApartado.Execute("Insert Into Monday(Num, Valid) Values ('" & str(A
    + I)) & "', '1');")
    CnnApartado.Execute("Insert Into Tuesday(Num, Valid) Values ('" & str(A
    + I)) & "', '1');")
    CnnApartado.Execute("Insert Into Wednesday(Num, Valid) Values ('" & str(A
    + I)) & "', '1');")

  2. #2
    Douglas J. Steele Guest

    Re: INSERT INTO TABLE BUT NOT IN ORDER

    "Order of records" is essentially meaningless in a relational database.

    If the order the records are returned is important to you, you need to add
    some field that you can use for ordering when you retrieve them.

    --

    Doug Steele, Microsoft Access MVP
    Beer, Wine and Database Programming. What could be better?
    Visit "Doug Steele's Beer and Programming Emporium"
    http://I.Am/DougSteele/


    MAVM <counterfeit31@hotmail.com> wrote in message
    news:392da73f$1@news.devx.com...
    >
    > ADO 2.1 and ACCESS 2000
    >
    > When i insert a few records into more than 1 table, the records are

    inserted
    > in aleatory forms that i can't understand because the records that are

    inserted
    > in the first table, i mean lets say monday the records are inserted at the
    > end of the table but in the next tables this records inserted in the

    middle
    > or start of the respective table.
    >
    > I HAVE THIS CODE:
    > A=50
    > For I = 1 To 10
    > CnnApartado.Execute("Insert Into Monday(Num, Valid) Values ('" & str(A
    > + I)) & "', '1');")
    > CnnApartado.Execute("Insert Into Tuesday(Num, Valid) Values ('" & str(A
    > + I)) & "', '1');")
    > CnnApartado.Execute("Insert Into Wednesday(Num, Valid) Values ('" &

    str(A
    > + I)) & "', '1');")
    > .
    > .
    > .
    > Next I
    >
    > If you have some experience in this kind of problems i would appreciate

    your
    > help pretty much.
    >
    > thanks.....




  3. #3
    Daniel Reber Guest

    Re: INSERT INTO TABLE BUT NOT IN ORDER


    Doug is right. Try creating an Identity field with a clustered index on it.

    Daniel Reber,MCP


    "Douglas J. Steele" <djsteele@idirect.com> wrote:
    >"Order of records" is essentially meaningless in a relational database.
    >
    >If the order the records are returned is important to you, you need to add
    >some field that you can use for ordering when you retrieve them.
    >
    >--
    >
    >Doug Steele, Microsoft Access MVP
    >Beer, Wine and Database Programming. What could be better?
    >Visit "Doug Steele's Beer and Programming Emporium"
    >http://I.Am/DougSteele/
    >
    >
    >MAVM <counterfeit31@hotmail.com> wrote in message
    >news:392da73f$1@news.devx.com...
    >>
    >> ADO 2.1 and ACCESS 2000
    >>
    >> When i insert a few records into more than 1 table, the records are

    >inserted
    >> in aleatory forms that i can't understand because the records that are

    >inserted
    >> in the first table, i mean lets say monday the records are inserted at

    the
    >> end of the table but in the next tables this records inserted in the

    >middle
    >> or start of the respective table.
    >>
    >> I HAVE THIS CODE:
    >> A=50
    >> For I = 1 To 10
    >> CnnApartado.Execute("Insert Into Monday(Num, Valid) Values ('" & str(A
    >> + I)) & "', '1');")
    >> CnnApartado.Execute("Insert Into Tuesday(Num, Valid) Values ('" & str(A
    >> + I)) & "', '1');")
    >> CnnApartado.Execute("Insert Into Wednesday(Num, Valid) Values ('" &

    >str(A
    >> + I)) & "', '1');")
    >> .
    >> .
    >> .
    >> Next I
    >>
    >> If you have some experience in this kind of problems i would appreciate

    >your
    >> help pretty much.
    >>
    >> thanks.....

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center