在VB quickfix中向sql命令添加参数时出错

时间:2016-01-26 15:26:02

标签: vb.net

我尝试传递参数pdata,需要从文本框中获取varchar并获取错误:

Method not found: 'Void System.Data.SqlClient.SqlParameterCollection.Rollback(System.String)'.

继承我的代码:

Protected Sub changeNum_Click(sender As Object, e As EventArgs) Handles changeNum.Click

    Dim retValue As Integer
    Dim connection As SqlConnection
    connection = New SqlConnection("Data Source=151-rsS\SQLEXPRESS;Initial Catalog=easyDb;Integrated Security=SSPI; ")
    Dim Command = New SqlCommand("UPDATE mytable Set pdata = @value1", connection)

    Command.Parameters.AddwithValue("@value1", htgtextbox.Text)
    connection.Open()
    retValue = Command.ExecuteNonQuery()
    connection.Close()

End Sub

0 个答案:

没有答案