Beispiel #1
0
        public string BuildSql(int idReg, string sPk)
        {
            string sCols  = " SELECT TOP 1 START AT " + idReg + " " + sPk;
            string sSQL   = BeginSql(_tables, "", sCols);
            string sOrder = Ordenes.SortingString();

            if (_gridEditable == false)
            {
                sOrder = GiveMeMainOrder(sOrder);
            }
            _whereClause = this.Clausulas.ComputeWhereClause();
            if (!string.IsNullOrEmpty(_whereClause))
            {
                sSQL += "\n" + _whereClause;
            }
            if (!string.IsNullOrEmpty(sOrder))
            {
                sSQL += "\n" + sOrder;
            }
            return(sSQL);
        }
Beispiel #2
0
        public string ConstruyeSQLDesplaza(string sPk, string sPkCriterio = " ASC ")
        {
            string sOrder = Ordenes.SortingString();
            string sCols  = "";

            if (!_gridEditable)
            {
                sOrder = GiveMeMainOrder(sOrder);
            }
            if (!string.IsNullOrEmpty(sOrder))
            {
                sCols = " SELECT ROW_NUMBER() OVER (" + sOrder + ") X, " + sPk + " VALOR ";
            }
            string sSQL = BeginSql(this._tables, "", sCols);

            _whereClause = Clausulas.ComputeWhereClause();
            if (!string.IsNullOrEmpty(_whereClause))
            {
                sSQL += "\n" + _whereClause;
            }
            return(sSQL);
        }