Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

DBGrid records order

I need to build a sistem that uses something like a Orders/Items tables relationship, with a DBGrid to store the Items data. But the typed records order Must not be changed. Something like to ignore the Items index. The typing order must not be changed
0
oberdan
Asked:
oberdan
  • 2
  • 2
1 Solution
 
ZifNabCommented:
can you give an example?
0
 
oberdanAuthor Commented:
My english is really bad... I'll try to explain.

In my Items table the recods are indexed by Item number. For each Order I'll haveone customer and several items.

I type the customer number and after I will type the items.
If in my items table I have:
 
I hope this helps you.
     ItemNo       Description
       1          Item 1
       2          Item 2
       3          Item 3
 
but in my Order I type 3, 1, 2, this sequence must not be changed.

0
 
rickpetCommented:
Create another table...we'll call it OrderDetail
This table will hold your Order's Detail info and will have a unique id...OrderDetail_id of type integer. This will be your primary index/key.  As the user inserts an item you generate a unique id for each item...

Order (master table)
  Order_id: integer key
  Customer_id: integer

OrderDetail (detail table)
  OrderDetail_id: integer key
  Order_id: integer key
  Item_id: integer
  Quantity: float

Rick
0
 
ZifNabCommented:
yep, rickpet has a good solution
0
 
rickpetCommented:
Are you having any other problems with this?

I hope this solved your problem...

Rick
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now