Home > Database > Mysql Tutorial > VB.NET中使用Linq TO SQL添加数据后获得自增长列ID

VB.NET中使用Linq TO SQL添加数据后获得自增长列ID

WBOY
Release: 2016-06-07 17:42:36
Original
1506 people have browsed it

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) Try db.SubmitChanges() ’提交数据库操作 Dim intid As Integer = tempOrdre.OrderID ‘获得自增长列ID MessageBox.Show(intid) ’显示ID Catch ex As Exception Throw New System.Exception(ex.Message, ex.InnerException) End Try

 

 

 

posted on

,美国服务器,香港服务器,香港虚拟主机
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template