示例#1
0
        //---------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// CountRows - count how many rows in the table
        /// </summary>
        /// <returns></returns>
        public int CountRows()
        {
            SqlConnection myConnection = DBUtils.GetNewSqlConnection();

            if (myConnection == null)
            {
                LogManager.writeToLog("New connection failed to open; mapping_note_Table.cs:SQLServer_CountRows.GetNewSqlConnection()");
                return(-1);
            }
            string strQuery = "SELECT COUNT(*)  FROM " + theTable;

            return(DBUtils.ExecuteSqlQueryScalar(strQuery, myConnection));
        }//CountRows
示例#2
0
        }//CountRows

        //---------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// CountRows_By_projectId - count how many rows match the projectID
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        public int CountRows_By_projectId(int projectId)
        {
            SqlConnection myConnection = DBUtils.GetNewSqlConnection();

            if (myConnection == null)
            {
                LogManager.writeToLog("New connection failed to open; affirmation_Table.cs:SQLServer_CountRows_By_projectId.GetNewSqlConnection()");
                return(-1);
            }
            string strQuery = "SELECT COUNT(*)  FROM " + theTable +
                              "  WHERE " + "projectId=" + projectId.ToString();

            return(DBUtils.ExecuteSqlQueryScalar(strQuery, myConnection));
        }//CountRows_By_projectId
示例#3
0
        }//CountRows

        //---------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// CountRows_By_processAre - count how many rows match the processAre
        /// </summary>
        /// <param name="processAre"></param>
        /// <returns></returns>
        public int CountRows_By_processAre(String processAre)
        {
            SqlConnection myConnection = DBUtils.GetNewSqlConnection();

            if (myConnection == null)
            {
                LogManager.writeToLog("New connection failed to open; weakness_Table.cs: SQLServer_CountRows_By_processAre.GetNewSqlConnection");
                return(-1);
            }
            string strQuery = "SELECT COUNT(*)  FROM " + theTable +
                              "  WHERE " + "processAre=" + processAre;

            return(DBUtils.ExecuteSqlQueryScalar(strQuery, myConnection));
        }//CountRows_By_processAre