@dbcommand null handling error with variable

Lease := “12345”;temp := @DbCommand( “ODBC” : “nocache” ; “nds”; “userid” ; “password” ; “SELECT BALANCE from table1 WHERE LEASENO = '”+ Lease + “'”:“0”);

When I execute it I receive the following error:

Invalid null replacement value, possible incorrect data type.

It works fine if I password static lease #

temp := @DbCommand( “ODBC” : “nocache” ; “nds”; “userid” ; “password” ; "SELECT BALANCE from table1 WHERE LEASENO = “12345”:“0”);

Anyone can help? I am not able to give up the null handling.

Kevin

Subject: RE: @dbcommand null handling error with variable

There’s no difference between a query coded as a constant string and the same query put together with variables – provided, of course, that the resulting query string contains the same characters in both cases!

I’m guessing the field LEASE does not contain the value you think it does when you execute this formula. Put an @Prompt in the formula to display the value before you do your lookup. If its value is not text, use @Text to convert it as you concatenate together the query expression.

Your quotes aren’t quite the same between the two versions either, but they look correct in the one that uses the variable, so that’s probably not the reason for the failure.