Solved

VB6 - Execute Update Statement

Posted on 2013-02-07
6
307 Views
Last Modified: 2013-02-08
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
0
Comment
Question by:Jimbo99999
6 Comments
 
LVL 18

Accepted Solution

by:
John (Yiannis) Toutountzoglou earned 100 total points
Comment Utility
RecordsAffected
Optional. A Long variable to which the provider returns the number of records that the operation affected.
see.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms675023(v=vs.85).aspx
0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 100 total points
Comment Utility
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 50 total points
Comment Utility
>You better use ExecuteNonQuery

Which will return you the intRecsAffected number(number of rows affected).
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Jimbo99999
Comment Utility
Thanks, I am trying this morning to get this converted.
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
Comment Utility
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

0
 

Author Closing Comment

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

jimbo99999
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now