VB.NET中使用Linq TO SQL添加数据后获得自增长列ID VB.NET中使用Linq TO SQL添加数据后获得自增长列ID: Dim tempOrdre As New Order With {.CustomerID = cmbCustomerName.SelectedValue.ToString,.ProductID = cmbProductSpec.SelectedValue.ToString,.Pro
VB.NET中使用Linq TO SQL添加数据后获得自增长列ID
VB.NET中使用Linq TO SQL添加数据后获得自增长列ID:
Dim tempOrdre As New Order With {.CustomerID = cmbCustomerName.SelectedValue.ToString,.ProductID = cmbProductSpec.SelectedValue.ToString,.ProductNumber = txtProductNumber.Text.Trim,.BatchNO = txtBatchNO.Text.Trim,.OrderDate = dtpOrderDate.Value.ToShortDateString}db.Order.InsertOnSubmit(tempOrdre)Trydb.SubmitChanges() ’提交数据库操作Dim intid As Integer = tempOrdre.OrderID ‘获得自增长列IDMessageBox.Show(intid) ’显示IDCatch ex As ExceptionThrow New System.Exception(ex.Message, ex.InnerException)End Try
posted on
,美国服务器,香港服务器,香港虚拟主机