ORDEREntity entity = orderDataSet1.ORDERTable.CreateEntity(); entity.CUSTOMERNAME =this.txtCustomerName.Text; entity.ORDERDATE = DateTime.Now; entity.PROCESSDATE = DateTime.Now; //Here I think it will be a nullable date type,but the framework now do not support this feature. entity.PROCESSUSER =""; orderDataSet1.ORDERTable.SetEntity(entity); ORDERSystem mgrSystem =new ORDERSystem(); if (!mgrSystem.InsertOrder(orderDataSet1)) { MessageBox.Show("Error occured at inserting order!Please check the log for the problem!"); } else { MessageBox.Show("Success to insert an order!You may using STRSQL or using navigator to see what inserted!"); }
1。新建一个Winform 名字是TestMultiTable 2. 添加using
using Wildfish.Data.ISeries; using Wildfish.BusinessFacade.ISeries; 3。画屏幕 4。编写Code 插入OrderItem
//thus is just a sample,so i do not add lot of validation int maxItemIndex =0; for (int i =0; i < orderDataSet1.ORDERITEMTable.Rows.Count; i++) { if (maxItemIndex < orderDataSet1.ORDERITEMTable.GetEntity(i).ITEMID) { maxItemIndex = orderDataSet1.ORDERITEMTable.GetEntity(i).ITEMID; } } maxItemIndex++; //It will be a new Item ORDERITEMEntity entity = orderDataSet1.ORDERITEMTable.CreateEntity(); entity.ITEMID = maxItemIndex; entity.PRICE = Convert.ToDecimal(this.txtPrice.Text); entity.PRODUCTNAME =this.txtProductName.Text; entity.QUANTITY = Convert.ToInt32(this.txtQuantity.Text); orderDataSet1.ORDERITEMTable.SetEntity(entity);