Ejemplo n.º 1
0
        /// <summary>
        /// Executes a command that returns a single value.
        /// </summary>
        /// <param name="commandText">The command text.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The return value of the command.</returns>
        protected override object ExecuteScalar(string commandText, SqlCeParameter[] parameters)
        {
            #if DEBUG && DebugDataLayer
            // Log Query Execution
            Trace.TraceInformation(GetType().Name + " SQL ExecuteScalar: " + commandText);
            #endif

            return(SqlCeApplicationBlock.ExecuteScalar(ConnectionString, CommandType.Text, commandText, parameters));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Executes a command that returns a single value.
        /// </summary>
        /// <param name="commandText">The command text.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The return value of the command.</returns>
        protected override object ExecuteScalar(string commandText, SqlCeParameter[] parameters)
        {
#if DEBUG && DebugDataLayer
            // Log Query Execution
            Trace.TraceInformation(GetType().Name + " SQL ExecuteScalar: " + commandText);
#endif
            using (var cc = UseCurrentConnection)
            {
                return(SqlCeApplicationBlock.ExecuteScalar(
                           (SqlCeConnection)cc.Connection, (SqlCeTransaction)cc.Transaction,
                           CommandType.Text, commandText, parameters));
            }
        }