public static XSafeBoolQuery ( |
||
connDesc | The database connection descriptor. This is used both as /// a key for caching connections/commands as well as for /// getting the actual database connection the first time. | |
transaction | SqlTransaction | The transaction to do this as part of. |
sql | string | The SQL query to execute. |
sqlParams | IEnumerable | A list of objects to use as parameters /// to the SQL statement. The list may be /// null if there are no parameters. |
return | bool |
public static bool XSafeBoolQuery(AbstractSqlConnectionDescriptor connDesc,
SqlTransaction transaction, string sql, IEnumerable sqlParams)
{
bool retVal;
object retObj = XSafeScalarQuery(connDesc, transaction, sql, sqlParams);
try
{
if (retObj == null)
{
throw new NullReferenceException(
"The sql query should have returned a boolean, but returned null instead.");
}
retVal = Convert.ToBoolean(retObj);
}
catch (Exception e)
{
throw new UnableToProcessSqlResultsException("Result was not boolean. ",
connDesc, sql, sqlParams, e);
}
return retVal;
}
SqlConnectionUtilities::XSafeBoolQuery ( |