Recordset.isnull — determine if a field contains SQL NULL
boolean Recordset.isnull ( |
index); |
| mixed | index; |
Returns true if the field named by index contains the SQL NULL value. index can be either an int value, in which case it is taken to be a zero based column index, or a string type in which case it is taken to be a column name. Some data sources are case sensitive when specifying column names.
Example 70. Recordset.isnull Example
// Get some data from a fictional recordset
Recordset rs = conn.openrs("SELECT CName, CEmail FROM TPeople WHERE CPersonID="
+ personid);
if(rs != null)
{
string name = rs.getstring("CName");
string email;
if(rs.isnull("CEmail"))
email = "<no email address>";
else
email = rs.getstring("CEmail");
rs.close();
}
Data sources and database access in RSP is explained in the section called “Accessing Databases”