[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VB6 - Execute Update Statement

Posted on 2013-02-07
6
Medium Priority
?
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 18

Accepted Solution

by:
John (Yiannis) Toutountzoglou earned 400 total points
ID: 38865804
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 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 400 total points
ID: 38866458
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 200 total points
ID: 38867347
>You better use ExecuteNonQuery

Which will return you the intRecsAffected number(number of rows affected).
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

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

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 38868089
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
ID: 38868576
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

649 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