当前位置: 首页>>代码示例>>C#>>正文


C# SelectCommand.ReturnScalar方法代码示例

本文整理汇总了C#中SelectCommand.ReturnScalar方法的典型用法代码示例。如果您正苦于以下问题:C# SelectCommand.ReturnScalar方法的具体用法?C# SelectCommand.ReturnScalar怎么用?C# SelectCommand.ReturnScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SelectCommand的用法示例。


在下文中一共展示了SelectCommand.ReturnScalar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Count

        /// <summary>
        /// Retorna o count, espera já uma query de count
        /// </summary>
        /// <param name="pConnectionString">String de conexão com o banco</param>
        /// <param name="pSelectQuery">Query para rodar (ex.: SELECT Count(PRV_ID) FROM Providers)</param>
        /// <returns></returns>
        public static decimal Count(ConnectionInfo pInfo, string pSelectQuery)
        {
            //TODO: Depois vai ter que criptografar pConnectionString e pSelectQuery

            SelectCommand lSelect = new SelectCommand(pSelectQuery);

            object lValue = lSelect.ReturnScalar(Instance.CreateDatabase(pInfo));

            return lValue.DBToDecimal();
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_LOTACAO,代码行数:16,代码来源:Select.cs

示例2: GetNext

        public static decimal GetNext(Transaction pTransaction, string pIDFieldValue)
        {
            decimal lID;

            // Inicializa operação
            OperationResult lReturn = new OperationResult(QueryDictionaries.SequencesQD.TableName, QueryDictionaries.SequencesQD.TableName);

            // Recupera Valor
            SelectCommand lSelectNext;

            string lSelectQuery = QueryDictionaries.SequencesQD.qSequencesMax;
            lSelectQuery += String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesQD._SEQ_NAME.Name);

            object lScalarReturn;

            lSelectNext = new SelectCommand(lSelectQuery);

            // Passagem dos Valores de Parametros para a Clausula WHERE [comando SELECT]
            lSelectNext.Fields.Add(QueryDictionaries.SequencesQD._SEQ_NAME.Name, pIDFieldValue, ItemType.String);

            // Recupera Valor do Select (Seq_Value)
            lScalarReturn = lSelectNext.ReturnScalar(pTransaction);

            if (lScalarReturn == null || lScalarReturn == DBNull.Value) lScalarReturn = 1;
            lID = Convert.ToDecimal(lScalarReturn);

            // Altera Valor da Sequence
            UpdateCommand lUpdate;
            lUpdate = new UpdateCommand(QueryDictionaries.SequencesQD.TableName);

            // Identificação dos Campos a serem Alterados
            lUpdate.Fields.Add(QueryDictionaries.SequencesQD._SEQ_VALUE.Name, lID, (ItemType) QueryDictionaries.SequencesQD._SEQ_VALUE.DBType);

            string lUpdateQuery;

            lUpdateQuery = String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesQD._SEQ_NAME.Name);
            lUpdate.Condition = lUpdateQuery;

            // Passagem dos Valores para a Condição Where do Update
            lUpdate.Conditions.Add(QueryDictionaries.SequencesQD._SEQ_NAME.Name, pIDFieldValue);

            // Execução do UPDATE
            lUpdate.Execute(pTransaction);

            // Retorna novo valor da chave [SEQUENCE VALUE]
            return lID;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_PETICOES,代码行数:47,代码来源:DataBaseSequence.cs

示例3: COUNT_GetAllPEDIDOCOMPRAById

        public static int COUNT_GetAllPEDIDOCOMPRAById(
             string iIndice,
             ConnectionInfo pInfo
         )
        {
            string lQuery = "";
             int lCount = 0;

             lQuery = "Select Count(*) from (";
             lQuery += PEDIDOCOMPRAQD.qPEDIDOCOMPRAList;
             lQuery += @" WHERE PEDCOMP_STATUS='A' AND SPED_STATUS='A' AND PF.PESF_STATUS = 'A' AND P.PES_STATUS = 'A'
                          AND PC.SPED_ID = S.SPED_ID
                          AND PC.PESF_SOLICITANTE = PF.PESF_ID
                          AND PF.PES_ID = P.PES_ID ";
             lQuery += " AND PC.SPED_ID = '{0}' )";
             lQuery = string.Format(lQuery, iIndice);

             SelectCommand lSelect = new SelectCommand(lQuery);
             lCount = int.Parse(lSelect.ReturnScalar(Instance.CreateDatabase(pInfo)).ToString());

             return lCount;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:22,代码来源:PEDIDOCOMPRADo.cs

示例4: Delete_proposto

        public static int Delete_proposto(
          ConnectionInfo pInfo,
          string pPESF_ID
       )
        {
            string lQuery = "";
            int lResult;
            Transaction lTransaction;

            lTransaction = new Transaction(Instance.CreateDatabase(pInfo));

            bool lLocalTransaction = (lTransaction != null);

            object lTable;

            lQuery = " DELETE FROM " + DIARIA_PROPOSTOQD.TableName;
            lQuery += " WHERE PESF_ID = " + pPESF_ID;

            SelectCommand lSelect = new SelectCommand(lQuery);

            try
            {
                lTable = lSelect.ReturnScalar(Instance.CreateDatabase(pInfo));
                lResult = 1;
            }
            catch (Exception Err)
            {

                lResult = 0;

                if (lLocalTransaction)
                    lTransaction.Rollback();
            }

            return lResult;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:36,代码来源:DIARIA_PROPOSTODo.cs

示例5: GetStatusMidDig

        public static int GetStatusMidDig(
         ConnectionInfo pInfo,
          string pMidDig

     )
        {
            string lQuery = "";
             int qtd = 0;

             lQuery = BIBLIOTECA_MIDIADIGITALQD.GetStatusMidDig;
             lQuery += " and imd.middig_id={0} AND middig_STATUS='A' and not exists(select * from biblioteca_itememprestimo ie ";
             lQuery += "where ie.cod_item=imd.imd_id and ie.ttab_id=3)";

             lQuery = string.Format(lQuery, pMidDig);

             SelectCommand lSelect = new SelectCommand(lQuery);
             qtd = int.Parse(lSelect.ReturnScalar(Instance.CreateDatabase(pInfo)).ToString());

             return qtd;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:20,代码来源:BIBLIOTECA_MIDIADIGITALDo.cs

示例6: GetNext

        public static decimal GetNext(ConnectionInfo pInfo, string pIDFieldValue)
        {
            Transaction lTransaction;
            DataBase lDataBase;

            lDataBase = Instance.CreateDatabase(pInfo);

            lTransaction = new Transaction(lDataBase);
            try
            {
                decimal lID;

                // Inicializa operação
                OperationResult lReturn = new OperationResult(QueryDictionaries.SequencesControlQD.TableName, QueryDictionaries.SequencesControlQD.TableName);

                // Recupera Valor
                SelectCommand lSelectNext;

                string lSelectQuery = QueryDictionaries.SequencesControlQD.qSequencesControlMax;
                lSelectQuery += String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesControlQD._CONTROLNAME.Name);

                object lScalarReturn;
                //APB.Framework.Math.Module11

                lSelectNext = new SelectCommand(lSelectQuery);

                // Passagem dos Valores de Parametros para a Clausula WHERE [comando SELECT]
                lSelectNext.Fields.Add(QueryDictionaries.SequencesControlQD._CONTROLNAME.Name, pIDFieldValue, ItemType.String);

                // Recupera Valor do Select (Seq_Value)
                lScalarReturn = lSelectNext.ReturnScalar(lTransaction);

                if (lScalarReturn == null || lScalarReturn == DBNull.Value) lScalarReturn = 1;
                lID = Convert.ToDecimal(lScalarReturn);

                // Altera Valor da Sequence
                UpdateCommand lUpdate;
                lUpdate = new UpdateCommand(QueryDictionaries.SequencesControlQD.TableName);

                // Identificação dos Campos a serem Alterados
                lUpdate.Fields.Add(QueryDictionaries.SequencesControlQD._CONTROLVALUE.Name, lID, (ItemType)QueryDictionaries.SequencesControlQD._CONTROLVALUE.DBType);

                string lUpdateQuery;

                lUpdateQuery = String.Format("WHERE {0} = >>{0}", QueryDictionaries.SequencesControlQD._CONTROLNAME.Name);
                lUpdate.Condition = lUpdateQuery;

                // Passagem dos Valores para a Condição Where do Update
                lUpdate.Conditions.Add(QueryDictionaries.SequencesControlQD._CONTROLNAME.Name, pIDFieldValue);

                // Execução do UPDATE
                lUpdate.Execute(lTransaction);

                lTransaction.Commit();
                // Retorna novo valor da chave [CONTROL VALUE]
                return lID;
            }
            catch (Exception ex)
            {
                lTransaction.Rollback();
                throw new UnknownException(ex);
            }
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_PETICOES,代码行数:63,代码来源:DataBaseSequenceControl.cs

示例7: GetStatusJrnlRevista

        public static int GetStatusJrnlRevista(
         ConnectionInfo pInfo,
          string pJR

     )
        {
            string lQuery = "";
             int qtd = 0;

             lQuery = BIBLIOTECA_JRNL_REVISTAQD.GetStatusJrnlRevista;
             lQuery += " and ijr.jrnl_revista_id={0} AND jrnl_revista_STATUS='A' and not exists(select * from biblioteca_itememprestimo ie ";
             lQuery += "where ie.cod_item=ijr.itemjrnl_revista_id and ie.ttab_id=2)";

             lQuery = string.Format(lQuery, pJR);

             SelectCommand lSelect = new SelectCommand(lQuery);
             qtd = int.Parse(lSelect.ReturnScalar(Instance.CreateDatabase(pInfo)).ToString());

             return qtd;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:20,代码来源:BIBLIOTECA_JRNL_REVISTADo.cs

示例8: COUNT_GetAllPedidosAlmoxarifado

        public static int COUNT_GetAllPedidosAlmoxarifado(
          ConnectionInfo pInfo, decimal pSPED_ID
        )
        {
            int lReturn = 0;

            string lQuery = "Select count(*) from (";
            lQuery += AcompanharQD.qAllPedidosAlmoxarifado;
            lQuery += @" where pm.pedido_status='A'
                        and dd.ddoc_status='A'
                        and pf.pesf_status='A'
                        and p.pes_status='A'
                        and setor.set_status='A'
                        and s.sped_status='A'
                        and pm.pesf_solicitante = pf.pesf_id
                        and pf.pes_id=p.pes_id
                        and pf.set_id=setor.set_id
                        and pm.doc_id = dd.doc_id
                        and s.sped_id = pm.sped_id
                        AND PM.SPED_ID = {0}
                        order by pm.PEDIDO_DATASOLICITACAO desc )";
            lQuery = string.Format(lQuery, pSPED_ID);

            SelectCommand lSelect = new SelectCommand(lQuery);
            lReturn = int.Parse(lSelect.ReturnScalar(Instance.CreateDatabase(pInfo)).ToString());

            return lReturn;
        }
开发者ID:andreibaptista,项目名称:DEF_PUB_DEFNET_PORTAL,代码行数:28,代码来源:AcompanharDo.cs


注:本文中的SelectCommand.ReturnScalar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。