当我尝试更新我的表时出现错误
这是代码
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
这就是错误
Primera excepción del Tipo 'System.Data.SqlClient.SqlException' en System.Data.dll
英语
System.Data.dll 中出现“System.Data.SqlClient.SqlException”类型的第一个异常