Update SQL data

I thought I couldn’t update the SQL table but I was actually updating it. There was a code page conflict which was messing up my updates. Since all the data looked messed up in the first place I thought it did not work. Anyway, after a stupid mistake and long hours of work you have a working example of SQL update.

On Error Goto trap

Dim LCSession As New LCSession

Dim LCConnection As New LCConnection(“oledb”)

LCConnection.provider = docProfile.GetItemValue(“NetsisProvider”)(0)

LCConnection.server = docProfile.GetItemValue(“NetsisServer”)(0)

LCConnection.database = docProfile.GetItemValue(“NetsisDatabase”)(0)

LCConnection.metadata = docProfile.GetItemValue(“NetsisMetadata”)(0)

LCConnection.UserID = docProfile.GetItemValue(“NetsisUserID”)(0)

LCConnection.Password = docProfile.GetItemValue(“NetsisPassword”)(0)

LCConnection.Connect

Dim confldlst As New Lcfieldlist

Dim count As Long

Dim fldContact As LCField

Dim fldCustID As LCField

Dim fldAddress As LCField

LCConnection.writeback = True

count = LCConnection.Select(Nothing, 1, confldlst)

Set fldContact = confldlst.Lookup(“CARI_ISIM”)Set fldCustID = confldlst.Lookup(“RAPOR_KODU2”)Set fldAddress = confldlst.Lookup(“CARI_ADRES”)

Do While (LCConnection.Fetch (conFldLst) > 0)

mCustID = fldCustID.Text(0)

bUpdated = False

If Not mCustID = “” Then

If GetContactByCustID() Then

If Not mContact = fldContact.text(0) Then

fldContact.text = mContact

bUpdated = True

End If

If Not mAddress = fldAddress.text(0) Then

fldAddress.text = mAddress

bUpdated = True

End If

If bUpdated Then

Call LCConnection.Update(confldlst)

End If

End If

End If

Loop

LCConnection.Action(LCACTION_COMMIT)

LCConnection.disconnect

trap:

etc.