开发者

VB.NET and Program Architecture

I would like to write a program like sales in which there's two table to insert i.e: SaleHeader Table and SaleDetails Table. The开发者_JS百科se two tables have (one to many) relationship. When I insert to SaleDetails Table I need to get SaleHeaderID to insert at SaleDetails.

Now I am using a stored procedure to insert SaleHeader information and to get back SaleHeaderID and I use query statements to insert SaleDetail information.

Any one can advise me for more effective way to insert to those two tables (having one to many relationship) ? Help me! Thanks in advance all.


One approach is to use a Guid for the SaleHeaderID. Then you can generate the new id in your stored procedure (using NEWID()) before inserting the header record, and then you will also know the id so you can use it for the details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜