コード例 #1
0
ファイル: DAO.cs プロジェクト: Nazeim/WSArchiver-29-5-2014
        public virtual int GetRecordsCount()
        {
            string condition = " 1 = 1 ";
            string statement = SqlStatememtGenerator.Select_ReadSomeColumnsByCondition(tableName, new string[] { "count(*)" }, condition);

            return Convert.ToInt32(executer.ExecuteScalarSelectStatement(statement, null));
        }
コード例 #2
0
        public int GetAssociationsCountOfSecondTable(T2 secondTableVO)
        {
            string condition = string.Format("{0}=@{0}", secondTableIdColumnName);
            string statement = SqlStatememtGenerator.Select_ReadSomeColumnsByCondition(tableName, new string[] { "count(*)" }, condition);

            SqlCeParameter[] parameters = new SqlCeParameter[1];
            parameters[0] = MakeSqlParameter(secondTableIdColumnName, secondTableVO.Id);

            int count = Convert.ToInt32(executer.ExecuteScalarSelectStatement(statement, parameters).ToString());

            return(count);
        }
コード例 #3
0
ファイル: DAO.cs プロジェクト: Nazeim/WSArchiver-29-5-2014
        public int GetMaxId()
        {
            string[] temp = new string[]{
                string.Format("max({0})", idColumnName)
            };
            string statement = SqlStatememtGenerator.Select_ReadSomeColumnsByCondition(tableName, temp, "1=1");

            try
            {
                int result = Convert.ToInt32(executer.ExecuteScalarSelectStatement(statement, null));
                return result;
            }
            catch
            {
                return -1;
            }

        }