Пример #1
0
 private ISqlResult GetSqlResult()
 {
     if (sqlResult == null)
     {
         string sql = String.Format("SELECT * FROM {0} WHERE {1}",
                                    TableName,
                                    GetWhereColumnValueString("=", "AND"));
         var rows = SqlProvider.ExecuteQuery(sql, SelectOptions.Single);
         if (rows.Count > 0)
         {
             sqlResult = rows[0];
         }
     }
     return(sqlResult);
 }
Пример #2
0
        private decimal CountRows()
        {
            string sql = String.Format("SELECT count(*) FROM {0} WHERE {1}",
                                       TableName,
                                       GetWhereColumnValueString("=", "AND"));
            var rows = SqlProvider.ExecuteQuery(sql, SelectOptions.Single);

            if (rows == null || rows.Count == 0)
            {
                return(0);
            }

            // Problem: different vendors return different
            // data types for numerics. We standardize on
            // decimal
            object val = rows[0].GetSingleResult();

            if (val == null)
            {
                return(0);
            }
            return(Decimal.Parse(val.ToString()));
        }