+ Start a Discussion
mat_tone_84mat_tone_84 

easy code for update doesn't work

Hi,
I came from vb6 and I try to write some code into visual studio express 2013 desktop. I look to this link "https://developer.salesforce.com/page/Integrating_Force.com_with_Microsoft_.NET" for get some ideas but i don't found the solution to my problem .
i need to update some fields of contact, this is my code, anyone can help me please? thanks
i imported into vbnet wsdl enterprise "wsdl.jsp.xml" from my salesforce 

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
        'sf = service references
        'sforce1 = web references
        Dim SfdcBinding As sforce1.SforceService = New sforce1.SforceService
        Dim CurrentLoginResult As sforce1.LoginResult

        CurrentLoginResult = SfdcBinding.login("myuser", "passtoken")

        SfdcBinding.Url = CurrentLoginResult.serverUrl
        SfdcBinding.SessionHeaderValue = New sforce1.SessionHeader
        SfdcBinding.SessionHeaderValue.sessionId = CurrentLoginResult.sessionId
        Dim contact() As SF.Contact
        contact(0) = New SF.Contact ' i use sf because sforce1 haven't a list of object lead,case,opportunity,contact,account...
        contact(0).Id = "0032000000Hppxn"
        contact(0).MobilePhone = "34911111111"

        Dim saveResults As sforce1.SaveResult
        saveResults = SfdcBinding.update(contact(0)) ' <---- HERE i have an error when compile: cannot convert sf.contact into matrix sforce1.sobject

        If saveResults.success Then
            MsgBox("update ok")
        Else
            MsgBox("update ko")
        End If
      
    End Sub
ShadowlessKickShadowlessKick
Thinking you just need to get rid of the zero element.

Dim SaveResults() As SForce1.SaveResult = SfdcBinding.update(New SForce1.sObject() {contact})
mat_tone_84mat_tone_84
thanks, i solve some weeks ago with vb.net.
i just stop to work with vb 6 :)