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


C# FbCommand.ExecuteScalar方法代码示例

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


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

示例1: inserir

        public int inserir(dsFROGIOS.USUARIORow ususario)
        {
            FbCommand comando = null;
            string sql =
                "INSERT INTO USUARIO "
               + "VALUES (NULL, "
               + paramNome + ", "
               + paramSenha + ", "
               + paramCategoria + ", "
               + paramDataCadastro + ") "
               + "RETURNING USUARIO_CODIGO;";

            comando = new FbCommand(sql, Conexao.getConexao, Conexao.getTransacao);
            comando.Parameters.AddWithValue(paramNome, ususario.USUARIO_NOME);
            comando.Parameters.AddWithValue(paramSenha, ususario.USUARIO_SENHA);
            comando.Parameters.AddWithValue(paramCategoria, ususario.USUARIO_CATEGORIA);
            comando.Parameters.AddWithValue(paramDataCadastro, ususario.USUARIO_DATA_CADASTRO);
            //try {
            //    comando.Parameters.AddWithValue(paramCategoria, ususario.USUARIO_CATEGORIA);
            //} catch (Exception) {
            //    comando.Parameters.AddWithValue(paramCategoria, null);
            //}

            return (int)comando.ExecuteScalar();
        }
开发者ID:Artenes,项目名称:frogi-os,代码行数:25,代码来源:TblUsuario.cs

示例2: RetornaUltimoValorGenerator

        public string RetornaUltimoValorGenerator(string sNomeGernerator)
        {
            FbConnection con = HlpDbFuncoesGeral.conexao;
            try
            {
                StringBuilder sSql = new StringBuilder();
                sSql.Append("Select ");
                sSql.Append("gen_id(" + sNomeGernerator.ToUpper() + ", 0) ");
                sSql.Append("from rdb$database");
                string sValor;
                FbCommand cmd = new FbCommand(sSql.ToString(), con);

                con.Open();
                sValor = cmd.ExecuteScalar().ToString();
                return sValor;

            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                con.Close();
            }

        }
开发者ID:dramosti,项目名称:GeraXml_3.0,代码行数:27,代码来源:daoGenerator.cs

示例3: atualizar

        public int atualizar(dsFROGIOS.ITEM_COMPRARow itemCompra)
        {
            FbCommand comando = null;
            string sql =
                "UPDATE ITEM_COMPRA "
                + "SET "
                + "ITEM_COMPRA_COMPRA = " + paramCompra + ", "
                + "ITEM_COMPRA_PRODUTO = " + paramProduto + ", "
                + "ITEM_COMPRA_PRECO = " + paramPreco + ", "
                + "ITEM_COMPRA_DESCONTO = " + paramDesconto + ", "
                + "ITEM_COMPRA_QUANTIDADE = " + paramQuantidade + ", "
                + "ITEM_COMPRA_PRECO_TOTAL = " + paramPrecoTotal + " "
                + "WHERE ITEM_COMPRA_CODIGO = " + paramCodigo + ";";

            comando = new FbCommand(sql, Conexao.getConexao, Conexao.getTransacao);
            comando.Parameters.AddWithValue(paramCodigo, itemCompra.ITEM_COMPRA_CODIGO);
            comando.Parameters.AddWithValue(paramCompra, itemCompra.ITEM_COMPRA_COMPRA);
            comando.Parameters.AddWithValue(paramProduto, itemCompra.ITEM_COMPRA_PRODUTO);
            comando.Parameters.AddWithValue(paramPreco, itemCompra.ITEM_COMPRA_PRECO);
            comando.Parameters.AddWithValue(paramDesconto, itemCompra.ITEM_COMPRA_DESCONTO);
            comando.Parameters.AddWithValue(paramQuantidade, itemCompra.ITEM_COMPRA_QUANTIDADE);
            comando.Parameters.AddWithValue(paramPrecoTotal, itemCompra.ITEM_COMPRA_PRECO_TOTAL);

            return (int)comando.ExecuteScalar();
        }
开发者ID:Artenes,项目名称:frogi-os,代码行数:25,代码来源:TblItemCompra.cs

示例4: BuscaChave

        public string BuscaChave(string sCD_SEQ)
        {
            try
            {
                string sQuery = "select c.cd_chavecte from conhecim c where c.nr_lanc = '{0}' and c.cd_empresa = '{1}'";

                sQuery = string.Format(sQuery, sCD_SEQ, belStatic.CodEmpresaCte);

                FbCommand cmd = new FbCommand(sQuery, cx.get_Conexao());
                cx.Open_Conexao();

                string sRet = cmd.ExecuteScalar().ToString();

                return sRet;
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao Gravar a Chave no Banco de Dados.");
            }
            finally
            {
                cx.Close_Conexao();
            }

        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:25,代码来源:daoGravaDadosRetorno.cs

示例5: atualizar

        public int atualizar(dsFROGIOS.COMPRARow compra)
        {
            FbCommand comando = null;
            string sql =
                "UPDATE COMPRA "
                + "SET COMPRA_NOTA_FISCAL = " + paramNotaFiscal + ", "
                + "SET COMPRA_FUNCIONARIO = " + paramFuncionario + ", "
                + "SET COMPRA_FORNECEDOR = " + paramFornecedor + ", "
                + "SET COMPRA_DESCONTO = " + paramDesconto + ", "
                + "SET COMPRA_ACRESCIMO = " + paramAcrescimo + ", "
                + "SET COMPRA_TOTAL = " + paramTotal + ", "
                + "SET COMPRA_DATA = " + paramData + " "
                + "WHERE COMPRA_CODIGO = " + paramCodigo + ";";

            comando = new FbCommand(sql, Conexao.getConexao, Conexao.getTransacao);
            comando.Parameters.AddWithValue(paramCodigo, compra.COMPRA_CODIGO);
            comando.Parameters.AddWithValue(paramNotaFiscal, compra.COMPRA_NOTA_FISCAL);
            comando.Parameters.AddWithValue(paramFuncionario, compra.COMPRA_FUNCIONARIO);
            comando.Parameters.AddWithValue(paramFornecedor, compra.COMPRA_FORNECEDOR);
            comando.Parameters.AddWithValue(paramDesconto, compra.COMPRA_DESCONTO);
            comando.Parameters.AddWithValue(paramAcrescimo, compra.COMPRA_NOTA_FISCAL);
            comando.Parameters.AddWithValue(paramTotal, compra.COMPRA_TOTAL);
            comando.Parameters.AddWithValue(paramData, compra.COMPRA_DATA);
            return (int)comando.ExecuteScalar();
        }
开发者ID:Artenes,项目名称:frogi-os,代码行数:25,代码来源:TblCompra.cs

示例6: BuscaCdDupli

        private bool BuscaCdDupli()
        {
            bool bGravarCdDupli = false;

            StringBuilder sSql = new StringBuilder();

            sSql.Append("Select ");
            sSql.Append("control.cd_conteud ");
            sSql.Append("from control ");
            sSql.Append("where ");
            sSql.Append("(control.cd_nivel = '");
            sSql.Append("1355");
            sSql.Append("')");

            if ((psNM_Banco.ToUpper().IndexOf("COMERCIOC") == -1) && (psNM_Banco.ToUpper().IndexOf("CERAMICAC") == -1))
            {
                using (FbCommand cmd = new FbCommand(sSql.ToString(), pConn))
                {
                    if (pConn.State != ConnectionState.Open)
                    {
                        pConn.Open();
                    }
                    bGravarCdDupli = (cmd.ExecuteScalar().ToString() == "S" ? true : false);

                    pConn.Close();
                }
            }
            else
            {
                bGravarCdDupli = true;
            }

            return bGravarCdDupli;

        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:35,代码来源:belProcessaNF.cs

示例7: RetornaProximoValorGenerator

        public static string RetornaProximoValorGenerator(string sNomeGen)
        {
            FbConnection con = new FbConnection(ConfigurationManager.ConnectionStrings["ConnectionStringFB"].ConnectionString.ToString());
            try
            {

                StringBuilder sQuery = new StringBuilder();
                sQuery.Append("Select ");
                sQuery.Append("gen_id(" + sNomeGen + ",1) ");
                sQuery.Append("from rdb$database ");

                FbCommand command = new FbCommand(sQuery.ToString(), con);
                con.Open();
                return command.ExecuteScalar().ToString();

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
开发者ID:dramosti,项目名称:Web,代码行数:25,代码来源:HlpDbFuncoesGeral.cs

示例8: belGerarXML

        public belGerarXML()
        {
            FbCommand InsertCmd = new FbCommand();
            FbCommand UpDate = new FbCommand();
            FbCommand DelCmd = new FbCommand();
            InicializeConnection();
            using (FbCommand cmd = new FbCommand("select control.cd_conteud from control where control.cd_nivel = '0016'", Conn))
            {
                Conn.Open();
                nm_Cliente = Convert.ToString(cmd.ExecuteScalar()).Trim();
                Conn.Close();
            }
            Globais LeRegWin = new Globais();
            this.psNM_Banco = LeRegWin.LeRegConfig("BancoDados");

            string[] sRamo = this.psNM_Banco.Split('\\');
            if (sRamo[sRamo.Count() - 1].ToUpper().Contains("TRANSPOR"))
            {
                belStatic.RAMO = "TRANSPORTE";
            }
            else if (sRamo[sRamo.Count() - 1].ToUpper().Contains("INDUSTRI"))
            {
                belStatic.RAMO = "INDUSTRIA";
            }
            else if (sRamo[sRamo.Count() - 1].ToUpper().Contains("COMERCIO"))
            {
                belStatic.RAMO = "COMERCIO";
            }
            else if (sRamo[sRamo.Count() - 1].ToUpper().Contains("CERAMICA"))
            {
                belStatic.RAMO = "CERAMICA";
            }
            sTipoIndustrializacao = LeRegWin.LeRegConfig("Industrializacao");
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:34,代码来源:belGerarxml.cs

示例9: RetornaGenString

        public string RetornaGenString(string sGen, int Tamanho)
        {
            string sNumArq = "";
            try
            {
                FbCommand sSql = new FbCommand();
                sSql.Connection = cx.get_Conexao();
                cx.Open_Conexao();
                sSql.CommandText = "SP_CHAVEPRI";
                sSql.CommandType = CommandType.StoredProcedure;
                sSql.Parameters.Clear();

                sSql.Parameters.Add("@SNOMEGENERATOR", FbDbType.VarChar, 31).Value = "GEN_NOMEARQXML";

                sNumArq = sSql.ExecuteScalar().ToString();

            }
            catch (FbException Ex)
            {               
                Console.WriteLine("Erro.: ", Ex.Message);
            }
            finally
            {
                cx.Close_Conexao();
            }
            return sNumArq.PadLeft(Tamanho, '0');
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:27,代码来源:belGerarXML.cs

示例10: BuscaUltimoNumeroConhecimento

 public string BuscaUltimoNumeroConhecimento(string sEmp)
 {
     try
     {
         string sQuery = "";
         if (belStatic.sNomeEmpresa.ToUpper().Equals("SICUPIRA") || belStatic.sNomeEmpresa.ToUpper().Equals("TRANSLILO") || belStatic.sNomeEmpresa.ToUpper().Equals("GCA"))  
         {
             string sGenerator = "CONHECIM_CTE" + belStatic.CodEmpresaCte;
             sQuery = "SELECT GEN_ID(" + sGenerator + ", 0 ) FROM RDB$DATABASE";
             using (FbCommand cmd = new FbCommand(sQuery, cx.get_Conexao()))
             {
                 cx.Open_Conexao();
                 return Convert.ToString(cmd.ExecuteScalar());
             }
         }
         else
         {
             sQuery = "select max(c.cd_conheci) from conhecim c where c.cd_empresa = '" + sEmp + "'";
             using (FbCommand cmd = new FbCommand(sQuery, cx.get_Conexao()))
             {
                 cx.Open_Conexao();
                 return Convert.ToString(cmd.ExecuteScalar());
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         cx.Close_Conexao();
     }
 }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:34,代码来源:daoGeraNumero.cs

示例11: NomeArqCte

        private string NomeArqCte()
        {
            FbConnection con = null;
            try
            {
                string sNomeArq = "";
                FbCommand cmd = new FbCommand();
                con = new FbConnection(HlpDbFuncoesGeral.MontaStringConexao());
                cmd.Connection = con;
                con.Open();
                cmd.CommandText = "SP_CHAVEPRI";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();

                cmd.Parameters.Add("@SNOMEGENERATOR", FbDbType.VarChar, 31).Value = "GEN_NOMEARQXML";

                sNomeArq = cmd.ExecuteScalar().ToString();

                return "Cte_" + sEmp + sNomeArq.PadLeft(15, '0') + ".xml";
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }

        }
开发者ID:dramosti,项目名称:GeraXml_3.0,代码行数:30,代码来源:belPopulaObjetos.cs

示例12: EliminarProveedorPorNIT

 public void EliminarProveedorPorNIT(string NIT)
 {
     string strquery = @"delete from PROVEEDOR
                         where NIT = " + NIT + ";";
     Connect();
     FbCommand cmd = new FbCommand(strquery, Gestor.Connection);
     cmd.ExecuteScalar();
 }
开发者ID:zheref,项目名称:InventarioInteligente,代码行数:8,代码来源:GestorProveedores.cs

示例13: CreateRecord

		private int CreateRecord(FbConnection connection, int commentId, bool commentCreated, bool full)
		{
			string sqlt = full ?
				"INSERT INTO MAIN (A, B, C, D, E, F, G, H, COMMENT_ID) VALUES ({0}, {1}, '{2}', '{3}', {0}, {1}, '{2}', '{3}', {4}) RETURNING ID" :
				"INSERT INTO MAIN (E, F, G, H, COMMENT_ID) VALUES ({0}, {1}, '{2}', '{3}', {4}) RETURNING ID";
			string sql = string.Format(sqlt, 666, 0, 'W', pRandomString, commentCreated ? commentId.ToString() : "NULL");
			FbCommand insert = new FbCommand(sql, connection);
			return (int)insert.ExecuteScalar();
		}
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:9,代码来源:DbTestFireBird.cs

示例14: inserir

        public int inserir(dsFROGIOS.MARCARow marca)
        {
            FbCommand comando = null;
            string sql =
                "INSERT INTO MARCA "
               + "VALUES (NULL, " + paramDescricao + ") "
               + "RETURNING MARCA_CODIGO;";

            comando = new FbCommand(sql, Conexao.getConexao, Conexao.getTransacao);
            comando.Parameters.AddWithValue(paramDescricao, marca.MARCA_DESCRICAO);
            return (int)comando.ExecuteScalar();
        }
开发者ID:Artenes,项目名称:frogi-os,代码行数:12,代码来源:TblMarca.cs

示例15: deletar

        public int deletar(dsFROGIOS.PERMISSAORow permissao)
        {
            FbCommand comando = null;
            string sql =
                "DELETE FROM PERMISSAO "
                + " WHERE PERMISSAO_CODIGO = " + paramCodigo + ";";

            comando = new FbCommand(sql, Conexao.getConexao, Conexao.getTransacao);
            comando.Parameters.AddWithValue(paramCodigo, permissao.PERMISSAO_CODIGO);

            return (int)comando.ExecuteScalar();
        }
开发者ID:Artenes,项目名称:frogi-os,代码行数:12,代码来源:TblPermissao.cs


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