Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL Get number of records affected in SQL Update

Hi
    I use several SQL update statements such the one below in my VB.net project.
    How do I get the number of records affected by each update statement?

     Dim sSQL As String

            sSQL = "Update [" & Me.lblCurrentTable.Text & "] Set Category1 = '" & Me.cmbCategory1.Text & "'"
            sSQL = sSQL & " Where [Product ID] = '" & oProductID & "'"

            Dim cn As New SqlConnection(My.Settings.CS)
            Dim cmd As New SqlCommand(sSQL, cn)

            cn.Open()
            cmd.ExecuteNonQuery()
            cn.Close()
SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thank you very much