Synchronization Editor, Native Database Connector, SQL-Server provisioning NULL values

Hi,

How can I synchronize a NULL value to a  MS SQL DB. (varchar null allowed)

1IM replaces Null values with each FullExport with "string Empty" value.

Thanks for any hint

Olivier

Parents Reply Children
  • I could fix it with this script based data operation:

    Dim store As IValueStore = data.Values.CreateValueStore()
    Dim sVisum as String = data.SystemObject.getValue("sAMAccountname","").ToString
    Dim sPersonalTitleGerman as String = store.getValue("personalTitleGerman","")

    ' Check if Attribute was changed. The IValueStore contains only the changed columns.
    ' Use data.SystemObject.GetValue to fetch values from unchanged columns of the object

    If store.Contains("personalTitleGerman") Then
    If String.IsNullOrEmpty(sPersonalTitleGerman) Then
    connection.ExecuteSqlNonQuery(store.Replace(String.Format("UPDATE Tel_Daten SET personalTitleGerman = NULL WHERE sAMAccountname = '{0}'",sVisum), True))
    Else
    connection.ExecuteSqlNonQuery(store.Replace(String.Format("UPDATE Tel_Daten SET personalTitleGerman = '" & sPersonalTitleGerman & "' WHERE sAMAccountname = '{0}'",sVisum), True))
    End If
    End If

  • Thanks for sharing your solution. Much appreciated.

  • You should reconsider the way your queries are build. Your example is vulnerable to sql injection.
    Currently provisioning a value like "foo'--" as personalTitleGerman will result in all entries in Tel_Daten being updated to personalTitleGerman = foo.