对于客户下达的所有订单,自动生成的ID应该保持不变 [英] Automatic generated Id should be constant for all the orders placed by the customer

查看:99
本文介绍了对于客户下达的所有订单,自动生成的ID应该保持不变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个客户正在输入订单详细信息,每次他只能从列表中输入一个订单,他想下5个项目的订单,订单ID将自动生成.应该是常量

A customer is entering the order details.Each time he can enter only one order from the list.He want to place an order for 5 items.order id will be automatically generated.But as long as he places the order the id should be constant

推荐答案

您的问题不清楚.但是根据我的猜测,我给你这个答案.
实际上,您需要3个表(只需添加所需的示例并添加更多字段).您应该分开项目详细信息.一对多.
Your question is not clear. But based on my guess I give you this answer.
Actually you need 3 tables(Just sample & add more fields you want). You should separate the items details. One to many.
TblCustomer
-------------
CustomerID
CustomerName

TblOrderMaster
-------------
OrderID
OrderDate
CustomerID

TblOrderDetails
-------------
OrderID
Items
Qty


所以数据会像这样


So the data will be like this

Customer Details
CustomerID CustomerName
----------------------------------------------------
1          Customer 1
2          Customer 2

Order Master
OrderID  OrderDate    CustomerID
----------------------------------------------------
101      01-Nov-2011  1
102      02-Nov-2011  1
103      03-Nov-2011  1

Order Details
OrderID  Items        Qty
----------------------------------------------------
101      BACON        10
101      PIZZA        5
102      BACON        5
102      PIZZA        15
102      DIET COKE    10
103      PIZZA        5



在这里Order 101包含2个项目,102包含3个项目.

使用 [



Here the Order 101 contains 2 items, 102 contains 3 items.

Use this[^] for Identity insert.


你好,

根据我对问题的理解,您可以做一件事:

每当客户选择第一个项目时,那时只需在DB中插入记录,并将您的ID保留在Session或其他位置,然后在每次插入时再次取回它.
我不确定这是否可以帮助您,因为问题写得不太清楚.
Hello,

As per my understanding of question, You can do one thing :

Whenever customer selects first item, at that time just insert record in DB and keep your ID in Session or somewhere else , and then on every insert fetch it again..

I am not sure if this will help you as question isn''t clearly written.


这篇关于对于客户下达的所有订单,自动生成的ID应该保持不变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆