帮助我关注Vb.net的问题 我有两个表&#34;购买&#34; 和其他一个&#34; stocklevel&#34; 每个表都有三列 < / p>
购买
ID,Item,Qt
stocklevel
ID,项目,级别
(ID是表 stocklevel 中的主键)
和我想要的是当我从购买表中保存价值时从输入框中收到(由用户输入),我希望值存在于&#34; Qt&#34;表格#34;购买&#34;列添加到列#34;级别&#34;表&#34; stocklevel&#34;这要通过检查ID
来完成我已经放了以下代码但没有工作
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Validate()
PurchaseBindingSource.EndEdit()
PurchaseTableAdapter.Update(TwoDataSet.Purchase)
'------------
strsql = "select * from stocklevel where ID = '" & IDTextBox.Text & "'"
Dim acscmd As New OleDb.OleDbCommand
acscmd.CommandText = strsql
acscmd.Connection = acsconn
'====================================================================
‘Creating a New connection to Table named stocklevel
If Not acsconn.State = ConnectionState.Open Then
acsconn.Open()
End If
Try
Dim strsql2 As String = "" & _
"UPDATE stocklevel SET level= level + "( & (Val(QtTextBox.Text) &) " where [ID]='" & IDtextbox.Text"'"
Dim acscmd2 As New OleDbCommand
acscmd2.Connection = acsconn
acscmd2.CommandText = strsql2
acscmd2.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
Finally
acsconn.Close()
End Try
acscmd.Dispose()
acscmd2.Dispose()
End Sub
先谢谢:)