示例#1
0
        public int ExecutePharmMDScalarInt(System.Data.Common.DbCommand command)
        {
            command.Connection = PmdConn;
            int returnVal = 0;

            command.CommandTimeout = 0;

            try
            {
                if (ConnectionState.Closed == PmdConn.State)
                {
                    PmdConn.Open();
                }

                returnVal = Convert.ToInt32(command.ExecuteScalar());
            }
            finally
            {
                if (ConnectionState.Open == PmdConn.State)
                {
                    PmdConn.Close();
                }
            }

            return(returnVal);
        }
示例#2
0
        public DataTable ExecutePharmMDTableQuery(System.Data.Common.DbCommand command)
        {
            DataTable      returnTable = new DataTable();
            SqlDataAdapter adapter     = new SqlDataAdapter((SqlCommand)command);

            command.Connection = PmdConn;

            try
            {
                if (PmdConn.State == ConnectionState.Closed)
                {
                    PmdConn.Open();
                }

                adapter.Fill(returnTable);
            }
            finally
            {
                if (ConnectionState.Open == PmdConn.State)
                {
                    PmdConn.Close();
                }
            }

            return(returnTable);
        }
        /// <summary>
        /// Executes a query with no return value.
        /// </summary>
        /// <param name="command">The raw command object.</param>
        public void ExecuteETLCoreNonQuery(System.Data.Common.DbCommand command)
        {
            command.Connection     = PmdConn;
            command.CommandTimeout = 0;

            try
            {
                if (ConnectionState.Closed == PmdConn.State)
                {
                    PmdConn.Open();
                }

                command.ExecuteNonQuery();
            }
            finally
            {
                if (ConnectionState.Open == PmdConn.State)
                {
                    PmdConn.Close();
                }
            }
        }