English 中文(简体)
• 如何更新与VBDapper的MS Access数据库中的印刷数量。 NET
原标题:How to update the total number of prints in the MS Access database with Dapper in VB.NET

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
问题回答

利用这一辛迪加:

.Numberofprints += 1,

可能改为:

Public Property Transno() As String




相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签