Ejemplo n.º 1
0
        /// <summary>
        /// Get One Row from DataBase
        /// </summary>
        /// <param name="oConn"></param>
        /// <param name="table"></param>
        /// <param name="where"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        public static DataRow fastOne(IDbPersist oConn, string table, string where = "", string order = "")
        {
            DataTable ar = ConnAccess.fastQuerie(oConn, table, where, order);

            // connAccess.fastQuerie( $oConn,  $table, $where, $order );


            if (ar.Rows.Count > 0)
            {
                DataRow ret = ar.Rows[0];
                return(ret);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static DataRow getRow(IDbPersist conn, string tabela, string pk, string id)
        {
            string sql = " select * from " + tabela + " where " + pk + "  = " + id;


            DataTable ds = new DataTable();

            ds = ConnAccess.fetchData(conn, sql);

            ds.TableName = tabela;

            if (ds.Rows.Count > 0)
            {
                return(ds.Rows[0]);
            }

            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Cria um DataRow de dados vazio
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="tabela"></param>
        /// <returns></returns>
        public static DataRow getNewRow(IDbPersist conn, string tabela)
        {
            string sql = " select * from " + tabela + " where 1 = 0 ";

            DataTable ds = new DataTable();

            try
            {
                ds = ConnAccess.fetchData(conn, sql);
                DataRow drr = ds.NewRow();

                drr.Table.TableName = tabela;
                return(drr);
            }
            catch (Exception exp)
            {
                throw exp;
            }

            return(null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Obtém uma linha DataRow.
        /// </summary>
        /// <param name="conn">Conexão Usada</param>
        /// <param name="tabela"></param>
        /// <param name="comp"></param>
        /// <returns></returns>
        public static DataRow getRow(IDbPersist conn, string tabela, string comp)
        {
            string sql = " select * from " + tabela + " where  1 = 1 " + comp;

            try
            {
                DataTable ds = new DataTable();
                ds = ConnAccess.fetchData(conn, sql);

                ds.TableName = tabela;

                if (ds.Rows.Count > 0)
                {
                    return(ds.Rows[0]);
                }
            }
            catch (Exception exp)
            {
                throw new Exception(sql + " - " + exp.Message);
            }
            return(null);
        }