Results 1 to 5 of 5

Thread: probably an easy question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    UK
    Posts
    164
    Hi I want to know an easy way to get data out of a record I have just inserted.

    For example at the moment I have a database used for storing orders. When an order is made I run a query which gets a "free" orderID by selecting the highest orderID in the table and adding one. All subsequent queries, functions etc can then use this ID.

    However this will take a long time if the table has a large number of records. Also bad things will happen if someone inserts another record in between this process happening and the actual insert. Although I guess I could change the lock type.

    Is there a way I can insert a record and have the orderID an autonumber field and then get the orderID of the record inserted.

    Hope this makes sense,

    Thanks

    Alex
    ASP, SQL, VB6, Java Script and dubious guitar playing skills.

  2. #2
    Guest
    What DBMS are you use???

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    UK
    Posts
    164
    Currently Access 2000 (dont worry it is for a small application).

    Alex
    ASP, SQL, VB6, Java Script and dubious guitar playing skills.

  4. #4
    Guest
    Hi

    Instead of use autonumber you can have a table with a field with orderid (to simulate autonumber).

    My 2 cents.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    UK
    Posts
    164
    I am sorry I dont understand, please explain further.

    Thanks,

    Alex
    ASP, SQL, VB6, Java Script and dubious guitar playing skills.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width