テーブルを更新しようとすると、エラーが発生します
これがコードです
Private Sub babonar_Click(sender As Object, e As EventArgs) Handles babonar.Click
Dim saldo As Decimal
Dim abonar As Double = 0
Dim cedula As String
Dim abono As New ClaseAbono
saldo = Convert.ToDecimal(ttsaldo.Text)
abonar = Convert.ToDouble(ttabonar.Text)
cedula = ttcecula.Text
abono.Nombre = ttnombre.Text
abono.Saldo = saldo
abono.Cedula = cedula
abono.Abonar = abonar
abono.Abono()
End Sub
これはクラスのコードです
Public Function Abono()
Dim vcedula As String = ""
Dim retur As Boolean
Dim saldoo As Double = 0
saldoo = xsaldo - xabonar
Dim sql As String = "update Cliente set Abono = @Abonar, Saldo = @saldoo where Cedula = @Cedula"
Using conn As New SqlConnection(sCon)
Dim command As New SqlCommand(sql, conn)
Try
command.Parameters.AddWithValue("Abono", xabonar)
command.Parameters.AddWithValue("Saldo", saldoo)
conn.Open()
command.ExecuteNonQuery()
Catch ex As SqlException
Console.WriteLine("Error actualizando datos ")
End Try
End Using
Return retur
End Function
これがエラーです
最初の例外 'System.Data.SqlClient.SqlException' en System.Data.dll
英語
タイプ 'System.Data.SqlClient.SqlException' の最初の例外が System.Data.dll で発生しました