I have SQl Database...And i am using visual basic 2010 i have a problem with Null values.When in my database data have some null values then data not showing in my crystal report ...crystal report showing blank..I want '0' when data is null..for example
my table name is (meetings with organization) and field name (Nature of meeting) which has 3 types
1 meetings
2 school visit
when in these types have no meetings data not showing in crystal report.please help me to show '-'/'0' in crystal report when data have null values,please send me code..and sorry for my english i am not expert in english.soryy for my english mistakes.

Junior Developer

Recommended Answers

Why don't you adjust your query so it returns 0 instead of null ?

Jump to Post

All 4 Replies

beacause i call the table directly database expert and then use new connection ..i use formula editor ..but i dont understand how to use my formula on my feild.
i also have Date Range formula..when i right isnull formula in record expert then errors generate like boolean error??

Can u understand Roman English?
junior Developer

You could use the COALESCE function. Given two or more parameters, it evaluates to the first parameter that is not null.

SELECT fieldName = COALESCE(fieldName,0) FROM myTable
SELECT fieldName = COALESCE(fieldName,'0') FROM myTable

will replace all null values with 0 or '0' in the returned data depending on whether the field is numeric or string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.