AdoConvertNullStringToNull() no longer supported

This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
Post Reply
User avatar
Kees Bouw
Posts: 136
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

AdoConvertNullStringToNull() no longer supported

Post by Kees Bouw »

Hi,

In Xs2Ado the function AdoConvertNullStringToNull() is no longer supported. Unfortunately the application I am working on (created in VO with Vo2Ado) uses this function and is quite dependent on it. I think this function makes sure that empty strings are stored as NULL values in the table. Consider this example:

Image

The top 5 ED values should be NULL like in the bottom 3 records which were created with Vo2Ado. Because they are just empty strings with Xs2Ado the query no longer works as it should and unwanted slash characters are added to the title value.

Question: Why was this function removed and what can I do to work around it without having to change every query, which would be an enormous lot of work?

Kees.
User avatar
robert
Posts: 4643
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: AdoConvertNullStringToNull() no longer supported

Post by robert »

Kees,
I will have to check.
This code was written many, many (15) years ago, when porting Vo2Ado to Vulcan.Net.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Kees Bouw
Posts: 136
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Re: AdoConvertNullStringToNull() no longer supported

Post by Kees Bouw »

robert wrote: Thu Jan 30, 2025 7:39 am Kees,
I will have to check.
This code was written many, many (15) years ago, when porting Vo2Ado to Vulcan.Net.

Robert
Robert,

Thank you for looking into this. It would be great if this function could be reinstated (perhaps in the announced Xs2Ado update?)

Kees.
Jamal
Posts: 334
Joined: Mon Jul 03, 2017 7:02 pm

Re: AdoConvertNullStringToNull() no longer supported

Post by Jamal »

Kees,

Do you want something like this function which you can use when your insert the data in the sql table?

FUNCTION AdoConvertNullStringToNull(value AS OBJECT) AS OBJECT
RETURN IIF(value == DBNull.Value .OR. value == NULL, "", value)
User avatar
Kees Bouw
Posts: 136
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Re: AdoConvertNullStringToNull() no longer supported

Post by Kees Bouw »

Jamal wrote: Thu Jan 30, 2025 4:18 pm Kees,

Do you want something like this function which you can use when your insert the data in the sql table?

FUNCTION AdoConvertNullStringToNull(value AS OBJECT) AS OBJECT
RETURN IIF(value == DBNull.Value .OR. value == NULL, "", value)
Hi Jamal,

Thank you for the suggestion but AdoConvertNullStringToNull() is actually a setting; with AdoConvertNullStringToNull(TRUE) NULL_STRINGS will be converted to NULL. The default behaviour is NOT to convert them to NULL.

Kees.
Jamal
Posts: 334
Joined: Mon Jul 03, 2017 7:02 pm

Re: AdoConvertNullStringToNull() no longer supported

Post by Jamal »

Hi Kees,

I see. Until then, have you thought about creating a table trigger or a database wide trigger to save empty strings to NULL?

Myself, I never needed that and I work with SQL Server a lot. I asked the same question to ChatGPT and it provided good answers about both options. If you wish I can post what it suggested here.
User avatar
Kees Bouw
Posts: 136
Joined: Wed Nov 06, 2019 11:35 am
Location: Netherlands

Re: AdoConvertNullStringToNull() no longer supported

Post by Kees Bouw »

Jamal wrote: Fri Jan 31, 2025 4:52 pm Hi Kees,

I see. Until then, have you thought about creating a table trigger or a database wide trigger to save empty strings to NULL?

Myself, I never needed that and I work with SQL Server a lot. I asked the same question to ChatGPT and it provided good answers about both options. If you wish I can post what it suggested here.
Hi Jamal,

It is an existing application, not written by me, I am converting from VO to X# and it relies on this setting to save empty strings as NULL. Of course I prefer not to make a lot of changes just because this setting has disappeared in the X# version. I am hoping very much that Robert will create a small update that brings back the function :) @Robert: have you had a chance to look at it?

Kees.
Post Reply