I m 试图与VB的Dapper一起更新MS Access数据库表中的印刷数量。 NET
我每次在纽伦举行活动时,都想将人数增加1人。
我的法典如下,但这仍然是错误的。 请指导我。
增 编
Dim pservice As New PeopleService()
Private Sub BtnPrint_Click(sender As Object, e As EventArgs) Handles BtnPrint.Click
Try
Dim objprint = New People With {
.Numberofprints = +1,
.Transno = TextBox1.Text}
pservice.UpdatePeoplePrint(objprint)
Catch err As Exception
MessageBox.Show(err.Message)
End Try
End Sub
Public Class People
Public Property Transno() As String
Public Property Numberofprints() As Integer
End Class
Public Class PeopleService
Public Sub UpdatePeoplePrint(ByVal Obj As People)
Dim sql = $"UPDATE People Set People.Numberofprints = {Obj.Numberofprints} WHERE [People.Transno] = {Obj.Transno} ;"
Using _conn = New OleDbConnection(GetOledbConnectionString())
_conn.Execute(sql)
End Using
End Sub
End Class
表: Peoples
Transno | Numberofprints |
---|---|
1000 | 1 |
1001 | |
1003 |
希望产出
Transno | Numberofprints |
---|---|
1000 | 2 |
1001 | 1 |
1003 | 1 |