function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rolando EstevesRolando Esteves 

VB Update statement not working

Hi!

 

Im currently tring to update a field from VB.NET to Salesforce but for some reason the code executes without problems but I do not see any changes on my salesforce instance: Heres my code :

 

Private Sub queryOpplnItem()

        Dim a_opplnitem(0) As netxarEE.sObject
        'Sql(Connection & Statements)
        Try
            con.ConnectionString = constr
            con.Open()
        Catch ex As Exception
            MsgBox("Error while establishing connection..." & ex.Message, "Insert Records")
        Finally
        End Try

        'get a list of oppLineItems
        Dim qr As QueryResult = Nothing
        qr = binding.query("Select Id,ITEMNMBR__c, Product_Description__c, ITEMCLASSCODE__c, CreatedDate From OpportunityLineItem WHERE oppcurrStage__c = " & "'Closed Won'")
        MsgBox(qr.records.Length)

        login()
        For i As Integer = 0 To qr.records.Length - 1
            Dim oppLnItm As OpportunityLineItem = qr.records(i)
            Dim itemQuery As String
            itemQuery = "INSERT INTO ITEMQTBL VALUES ('"
            itemQuery = itemQuery & oppLnItm.Id & "'" & ","
            itemQuery = itemQuery & "'" & oppLnItm.ITEMNMBR__c & "'" & ","
            itemQuery = itemQuery & "'" & oppLnItm.ITEMCLASSCODE__c & "'" & ","
            itemQuery = itemQuery & "'" & oppLnItm.CreatedDate & "'" & ","
            itemQuery = itemQuery & "'" & "0" & "'" & ")"
            cmd = New SqlCommand(itemQuery, con)
            cmd.ExecuteNonQuery()
            MsgBox(oppLnItm.Product_Description__c & oppLnItm.CreatedDate)
            ReDim a_opplnitem(i)
            oppLnItm.Id = qr.records(i).Id
            oppLnItm.Transfer2GP__c = True
            a_opplnitem(i) = oppLnItm
        Next
        binding.update(a_opplnitem)
        con.Close()
    End Sub

 

Rolando EstevesRolando Esteves

Must specify -----> the specify oli.Transfer2GP__cSpecified = True