Update without dataset? RRS feed

  • Question

  • I want to execute a sqlquery in a table from VB2008Express without haveing any dataset but i get adapter.Update() requires a dataset. How can i pass my query to the MSSQL server?


    Here is the code i wrote


    Using connection As New SqlConnection(connectionString)

    Dim adapter As New SqlDataAdapter()


    Dim sqlquery As String

    sqlquery = "UPDATE tblname SET done=1 WHERE user_id=28"

    Dim userCommand As SqlCommand = New SqlCommand(sqlquery, connection)

    userCommand.CommandType = CommandType.Text

    adapter.UpdateCommand = userCommand





    End Using

    Friday, April 11, 2008 2:22 PM