这是我的代码
Private Sub btn_fast200_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_fast200.Click
Using _conn As New SqlConnection("Data Source=HOME-PC; Initial Catalog=csbanking; Integrated Security= true")
Using _comm As New SqlCommand()
With _comm
.Connection = _conn
.CommandText = "UPDATE USERLOGIN SET USER_BALANCE = @balance + USER_BALANCE WHERE USER_LOGIN=@id"
.CommandType = CommandType.Text
.Parameters.AddWithValue("@balance", -200)
.Parameters.AddWithValue("@id", Login.txt_id.Text)
End With
Try
_conn.Open()
_comm.ExecuteNonQuery()
Catch ex As SqlException
MsgBox(ex.Message.ToString())
End Try
End Using
End Using
MessageBox.Show("Transaction Success")
_1stpage.Show()
Login.txt_id.Text = ""
Security.msktxt_pin.Text = ""
Me.Hide()
End Sub
添加后无法更新余额(“WHERE USER_LOGIN = @ id”)