Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

VB6 - Execute Update Statement

Good Day Experts!

I am trying to understand what is happening at the end of this line of code so I can translate it to VB.Net.  

Here is the line:
SQLconn99.Execute ("Update [PROCESSING] SET [MISROUTE ROUTED CARRIER] ='BILL OK',[MISROUTE ROUTED COST] = 0  WHERE [PRO NUMBER]='" & pdoxRS(0) & "' AND [PRO CODE]='" & pdoxRS("PRO CODE") & "' AND [PRO OCCURRENCE]=" & pdoxRS("PRO OCCURRENCE") & " AND [SCAC]='" & pdoxRS("SCAC") & "'"), intRecsAffected

I have been unable to find a structure definition for what "intRecsAffected"  is at the end of the statement.

I have to convert this to VB.Net so I am trying to understand.  

Thanks,
jimbo99999
ASKER CERTIFIED SOLUTION
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece 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
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada 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
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 Jimbo99999

ASKER

Thanks, I am trying this morning to get this converted.
if you are using sql Server this might be you code...
 Dim conn As New SqlConnection("MyProjectConnectionString")
        If conn.State = ConnectionState.Open Then conn.Close()
        conn.Open()

        Dim StrSql As String = "Update [PROCESSING] SET [MISROUTE ROUTED CARRIER] ='BILL OK',[MISROUTE ROUTED COST] = 0  WHERE [PRO NUMBER]=@pdoxRS1 AND [PRO CODE]=@pdoxRS2 AND [PRO OCCURRENCE]=@pdoxRS3 AND [SCAC]=@pdoxRS4"
        Dim SqlCmd As New SqlCommand(StrSql, conn)

        'parameters
        Dim Parameter1 As New SqlParameter("@pdoxRS1", pdoxRS(0))
        Dim Parameter2 As New SqlParameter ("@pdoxRS2",pdoxRS(PRO CODE))
        Dim parameter3 As New SqlParameter ("@pdoxRS3",pdoxRS(PRO OCCURRENCE))
        Dim parameter4 As New SqlParameter("@pdoxRS4", pdoxRS(SCAC))

        'add parameter to command
        SqlCmd.Parameters.Add(Parameter1)
        SqlCmd.Parameters.Add(Parameter2)
        SqlCmd.Parameters.Add(Parameter3)
        SqlCmd.Parameters.Add(parameter4)


        Dim intRowsAffected = SqlCmd.ExecuteNonQuery

        conn.Close()
        SqlCmd.Dispose()
        conn.Dispose()
        GC.Collect()

Open in new window

Thanks for the reference and info to duplicate.  Another item for the back pocket as I continue in this learning process.

jimbo99999