Skip to Content
0
Former Member
Feb 17, 2009 at 04:19 AM

Business Partner Update porblem

36 Views

Hi,

I am trying to udate the business partner through SDK.

Code give me return value 0 but still I record is not updated in the database.

Please help me to resolve this issue.

Code :

oBusinessPartner.GetByKey(rdr.Item("CCode").ToString)

oBusinessPartner.CardName = rdr.Item("CName").ToString

oBusinessPartner.CardForeignName = "Gunjan"

selectStr = "SELECT dflbnkcode from OADM"

ors = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

ors.DoQuery(selectStr)

If ors.RecordCount > 0 Then

oBusinessPartner.HouseBank = ors.Fields.Item(0).Value

End If

SBO_Application.MessageBox("Bank Code : " & ors.Fields.Item(0).Value)

selectStr = "select dflbnkacct from OADM"

ors = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

ors.DoQuery(selectStr)

If ors.RecordCount > 0 Then

oBusinessPartner.HouseBankAccount = ors.Fields.Item(0).Value

End If

errMsg = ""

'oBusinessPartner.get()

oBusinessPartner.GetByKey(rdr.Item("CCode").ToString)

m = oBusinessPartner.Update

If m = 0 Then

updateStr = "update VendorMaster set [Update] = null where "

updateStr = updateStr & " CCode = '" & rdr.Item("CCode").ToString & "'"

cmd2 = New SqlCommand(updateStr, cn2)

If cn2.State = ConnectionState.Open Then

cn2.Close()

End If

cn2.Open()

cmd2.ExecuteNonQuery()

Else

Call oCompany.GetLastError(Err, errMsg)

End If