You are not logged in.
Pages: 1
ab, As you already know we are using TSynDBDataSet in our project
We are experiencing a quite odd issue when using TSynDBDataSet(ds1.DataSet).ApplyUpdates(0), the changes are not applied if the row contains a column with empty string, but it's not NULL.
For example we are inserting rows:
fProps.ExecuteNoResult(
'INSERT INTO MyData (column1, column2, column3) '+
'VALUES (?,?,?)',
[WideStringToUTF8(myvalue1),
WideStringToUTF8(myvalue2),
WideStringToUTF8(myvalue3)
]);
If myvalue3='' (empty string), when we made changes to the row and TSynDBDataSet(ds1.DataSet).ApplyUpdates(0), the changed don't commit. There is no error message.
If we change the value of the column3, to not be empty, commit will work.
The only way to fix this issue is to not add the column3 to the INSERT statement if myvalue3 is empty.
Is there any other way we could fix it?
When the string it's empty, insert to set NULL value for that column.
Thanks
Offline
In my case (ODBC-Connection), the changes are applied, but the inserted value is 'null'.
It is not possible to set an empty string or clear the field.
E.g. FieldByName('Field').AsString = '' -> inserts the string 'null'
and FieldByName('Field').Clear -> insterts the string 'null', too.
It ends up in TSQLDBStatement.BindVariant, Default (no match for TVarData(Data).VType) -> VariantToUTF8(undefined) -> 'null'
Is it possible to keep TDataSet-Compatibility here?
Offline
Pages: 1