Hi!
There is also third and forth approaches:
3. ‘Some text ’+ alltrim(
transform(myCursor.cfield1,""))+’ ‘+alltrim(
transform(myCursor.cfield2,""))
Transform() function will convert all NULL values to whatever is defined by SET NullDisplay command.
4. Also, for SQL Server you can use a query that will return you the result already without NULL values:
(“Select IsNull(cfield1," ") as cField1, IsNull(cfield2," ") as cField2 from mytable”,”myCursor”)
Hope this helps.
>Hallo all
>I have a problems with NULL values in characterstrings that I hope I can explain so you understand:
>
>I make a select from an SQL server like this: (“Select cfield1, cfield2 from mytable”,”myCursor”)
>In the result I get some null values in fields that contains no data on the server.
>I present the fields in a form like this: ‘Some text ’+ alltrim(myCursor.cfield1)+’ ‘+alltrim(myCursor.cfield2)
>When both fields contains data, there are no problems, BUT…
>If one of the fields contains a null value, nothing will be displayed in the form.
>If cfield1 have a NULL value, I want this to be displayed: “Some text ”+ the contents in cfield2.
>
>Does anyone have an idea how to manage this?
>
>My only solutions right now is to…
>1. replace all NULL values with a single space in the whole 'myCursor' before I use it.
>2. replace all NULL values with a single space in the whole table on the server, and allways save new records with spaces in the fields which the user has left empty.
>
>But I feel that its not any good solutions.
>
>Thanks in advance
>/Kjell
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.