Jimbo99999
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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()
ASKER
Thanks for the reference and info to duplicate. Another item for the back pocket as I continue in this learning process.
jimbo99999
jimbo99999
ASKER