0

i tried passing the parameter pdata which needs to b a varchar from a textbox and get the error :

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

heres my code :

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
9
  • 1
    Your reason is you are trying to use SqlConnection & SqlCommand which will not work for the version you are targeting... You are using SqlExpress and you can't use the one's I mention above... You need to look at sqlcecommand and sqlceconnection... The ce is for Compact Edition Commented Jan 26, 2016 at 15:45
  • its the addwith value line that throws it Commented Jan 26, 2016 at 15:45
  • @codexer how do i go about changing it over? Commented Jan 26, 2016 at 15:46
  • Change what class you are targeting for your command and connections. Commented Jan 26, 2016 at 15:46
  • You need to import System.Data.SqlServerCe to use it... Also I have answered similar question stackoverflow.com/questions/21390748/… there... Commented Jan 26, 2016 at 15:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.