In Visual Basic 6.0
I have a String:
Dim sVal as String
sVal = "call_proc '" & sParam1 & "','" & sParam2 & "','" & sParam3
each param is also a string passed to the function
some of the string parameters might be empty, which might produce a value like this if, for example, sParam2 was empty:
result of concatenation:
call_proc 'value1', '', 'value2'
so far so good.
I want to then replace any resulting ,'', with ,NULL, so that the output would read like this:
call_proc 'value1', NULL, 'value2'
and I tried doing so as follows:
Dim sNew As String
sNew = Replace(sVal, "''", "NULL")
I tested this using a dummy string:
sNew = Replace(sVal, "''", "HELLO WORLD")
and the replace happened as expected. However, when trying to replace with the actual string that reads NULL, I end up with no conversion, and the result reads:
call_proc 'value1', '', 'value2
So how do I use VB replace() method and actually insert the string that reads NULL, that is, the word, not any kind of VB Constant?