示例#1
0
 public static object SelectScalar(string sqlString, DataAccessParameterCollection paraCollection)
 {
     using (DataAccessBroker broker = DataAccessFactory.Instance())
     {
         return(broker.ExecuteScalar(sqlString, paraCollection, CommandType.Text));
     }
 }
示例#2
0
 /// <summary>
 /// ExecuteScalar 并返还回唯一值
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="wb"></param>
 /// <param name="defaultValue"></param>
 /// <returns></returns>
 public static T ExecuteScalar <T>(WhereBuilder wb, T defaultValue)
 {
     using (DataAccessBroker broker = DataAccessFactory.Instance())
     {
         object result = broker.ExecuteScalar(wb);
         if (result != null && result != DBNull.Value)
         {
             defaultValue = (T)result;
         }
     }
     return(defaultValue);
 }