Dim objConn As New SqlConnection
Dim objCmd As New SqlCommand
Dim dtReader As SqlDataReader
Dim strConnString,strSQL As String
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
strConnString = "Server=localhost;Uid=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn.ConnectionString = strConnString
objConn.Open()
strSQL = "UPDATE Product SET " & _
" STOCK = STOCK - '"& Me.txtQty.Text &"' " & _
" WHERE ProductID = '" & Me.txtProductID.Text & "' "
objCmd = New SqlCommand
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
objCmd.ExecuteNonQuery()
End Sub