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


C# FbCommand.Dispose方法代码示例

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


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

示例1: AbortTransaction

        public void AbortTransaction()
        {
            FbTransaction transaction = null;
            FbCommand command = null;

            try
            {
                transaction = this.Connection.BeginTransaction();

                command = new FbCommand("ALTER TABLE \"TEST\" drop \"INT_FIELD\"", this.Connection, transaction);
                command.ExecuteNonQuery();

                transaction.Commit();
                transaction = null;
            }
            catch (Exception)
            {
                transaction.Rollback();
                transaction = null;
            }
            finally
            {
                if (command != null)
                {
                    command.Dispose();
                }
            }
        }
开发者ID:voloda,项目名称:firebird-NETProvider,代码行数:28,代码来源:FbTransactionTests.cs

示例2: InsertGuidTest

		public void InsertGuidTest()
		{
			FbCommand createTable = new FbCommand("CREATE TABLE GUID_TEST (GUID_FIELD CHAR(16) CHARACTER SET OCTETS)", Connection);
			createTable.ExecuteNonQuery();
			createTable.Dispose();

			Guid newGuid = Guid.Empty;
			Guid guidValue = Guid.NewGuid();

			// Insert the Guid
			FbCommand insert = new FbCommand("INSERT INTO GUID_TEST (GUID_FIELD) VALUES (@GuidValue)", Connection);
			insert.Parameters.Add("@GuidValue", FbDbType.Guid).Value = guidValue;
			insert.ExecuteNonQuery();
			insert.Dispose();

			// Select the value
			FbCommand select = new FbCommand("SELECT * FROM GUID_TEST", Connection);
			using (FbDataReader r = select.ExecuteReader())
			{
				if (r.Read())
				{
					newGuid = r.GetGuid(0);
				}
			}

			Assert.AreEqual(guidValue, newGuid);
		}
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:27,代码来源:GuidTests.cs

示例3: Cadastrar

        public void Cadastrar(Agendamento obj)
        {
            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "INSERT INTO AGENDAMENTO (EMPRESA, FILIAL, FUNCIONARIO, CLIENTE,STATUS,DATAPREVISTO, " +
                                         "INICIOPREVISTO,FIMPREVISTO,TRASLADOPREVISTO, RESUMOAGENDAMENTO) " +
                                         "VALUES (@EMPRESA,@FILIAL,@FUNCIONARIO,@CLIENTE, @STATUS, @DATAPREVISTO, @INICIOPREVISTO, " +
                                         "@FIMPREVISTO,@TRASLADOPREVISTO, @RESUMOAGENDAMENTO)";
                sqlCommand.Parameters.AddRange(this.ParametrizarComando(obj));
                sqlCommand.ExecuteNonQuery();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }
        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:27,代码来源:AgendamentoDAO.cs

示例4: Cadastrar

        public void Cadastrar(Meta obj)
        {
            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "INSERT INTO META (EMPRESA, FILIAL, DESCRICAO, DATACADASTRO, INDICADOR, FUNCIONARIO) " +
                                         "VALUES (@EMPRESA, @FILIAL, @DESCRICAO, @DATACADASTRO, @INDICADOR, @FUNCIONARIO)";

                sqlCommand.Parameters.AddRange(this.ParametrizarComando(obj));
                sqlCommand.ExecuteNonQuery();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }

        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:27,代码来源:MetaDAO.cs

示例5: Cadastrar

        public void Cadastrar(Projeto obj)
        {
            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "INSERT INTO PROJETOS (CLIENTE, EMPRESA, FILIAL, HORASGERENTE, HORASCONSULTOR, HORASCOORDENADOR, DESCRICAO, META) " +
                                         "VALUES (@CLIENTE, @EMPRESA, @FILIAL, @HORAGERENTE, @HORACONSULTOR, @HORACOORDENADOR, @DESCRICAO, @META)";

                sqlCommand.Parameters.AddRange(this.ParametrizarComando(obj));
                sqlCommand.ExecuteNonQuery();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }
        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:26,代码来源:ProjetoDAO.cs

示例6: ContratoTemItens

        public static bool ContratoTemItens(string contrato)
        {
            bool retorno = false;

            conn = AcessoDados.AcessoDados.getConn();

            FbCommand comando = new FbCommand("select COUNT(*) as contador from sci_licitacao_contrato_itens lci where lci.ctrcod = @CONTRATO",conn);

            FbParameter IDCONTRATO = new FbParameter("@CONTRATO", FbDbType.Integer);
            IDCONTRATO.Value = contrato;
            comando.Parameters.Add(IDCONTRATO);

            conn.Open();
            FbDataReader dr = comando.ExecuteReader();
            while (dr.Read()) {
                if (Convert.ToInt16(dr["contador"]) > 0)
                {
                    retorno = true;
                }
                else {
                    retorno = false;
                }
            }
            conn.Close();
            comando.Dispose();
            return retorno;
        }
开发者ID:EmersonBessa,项目名称:FluxusWeb,代码行数:27,代码来源:Contratos.cs

示例7: InsertNullGuidTest

		public void InsertNullGuidTest()
		{
			FbCommand createTable = new FbCommand("CREATE TABLE GUID_TEST (INT_FIELD INTEGER, GUID_FIELD CHAR(16) CHARACTER SET OCTETS)", Connection);
			createTable.ExecuteNonQuery();
			createTable.Dispose();

			// Insert the Guid
			FbCommand insert = new FbCommand("INSERT INTO GUID_TEST (INT_FIELD, GUID_FIELD) VALUES (@IntField, @GuidValue)", Connection);
			insert.Parameters.Add("@IntField", FbDbType.Integer).Value = this.GetId();
			insert.Parameters.Add("@GuidValue", FbDbType.Guid).Value = DBNull.Value;
			insert.ExecuteNonQuery();
			insert.Dispose();

			// Select the value
			FbCommand select = new FbCommand("SELECT * FROM GUID_TEST", Connection);
			using (FbDataReader r = select.ExecuteReader())
			{
				if (r.Read())
				{
					if (!r.IsDBNull(1))
					{
						throw new Exception();
					}
				}
			}
		}
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:26,代码来源:GuidTests.cs

示例8: InsertNullGuidTest

		public void InsertNullGuidTest()
		{
			// Insert the Guid
			var id = GetId();
            FbCommand insert = new FbCommand("INSERT INTO GUID_TEST (INT_FIELD, GUID_FIELD) VALUES (@IntField, @GuidValue)", Connection);
			insert.Parameters.Add("@IntField", FbDbType.Integer).Value = id;
			insert.Parameters.Add("@GuidValue", FbDbType.Guid).Value = DBNull.Value;
			insert.ExecuteNonQuery();
			insert.Dispose();

			// Select the value
			using (FbCommand select = new FbCommand("SELECT * FROM GUID_TEST WHERE INT_FIELD = @IntField", Connection))
			{
				select.Parameters.Add("@IntField", FbDbType.Integer).Value = id;
				using (FbDataReader r = select.ExecuteReader())
				{
					if (r.Read())
					{
						if (!r.IsDBNull(1))
						{
							throw new Exception();
						}
					}
				}
			}
		}
开发者ID:nakagami,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:26,代码来源:GuidTests.cs

示例9: Cadastrar

        public void Cadastrar(OrdemServico obj)
        {
            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "INSERT INTO ORDEM_SERVICO (EMPRESA, FILIAL, CLIENTE, FUNCIONARIO, DATA, INICIO, FIM, TRANSLADO, ATIVIDADE, "+
                                          "FATURADO, STATUS, OBSERVACAO, PROJETO, TIPOHORA) " +
                                          "VALUES (@EMPRESA, @FILIAL, @CLIENTE, @FUNCIONARIO, @DATA, @INICIO, @FIM, @TRANSLADO, @ATIVIDADE, "+
                                          "@FATURADO, @SITUACAO, @OBSERVACAO, @PROJETO, @TIPOHORA)";
                sqlCommand.Parameters.AddRange(this.ParametrizarComando(obj));
                sqlCommand.ExecuteNonQuery();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }
        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:27,代码来源:OrdemServicoDAO.cs

示例10: Cadastrar

        public void Cadastrar(Periodo obj)
        {
            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "INSERT INTO PERIODO (EMPRESA, FILIAL, ANO, MES, REALIZADO, ESPERADO, META, FUNCIONARIO) VALUES "+
                                         "(@EMPRESA, @FILIAL, @ANO, @MES, @REALIZADO, @ESPERADO, @META, @FUNCIONARIO)";

                sqlCommand.Parameters.AddRange(this.ParametrizarComando(obj));
                sqlCommand.ExecuteNonQuery();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }
        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:26,代码来源:PeriodoDAO.cs

示例11: check_func

 public static bool check_func(FbConnectionStringBuilder fc)
 {
     bool res_ = false;
     using (FbConnection fb = new FbConnection(fc.ConnectionString))
     {
         try
         {
             fb.Open();
             using (FbTransaction ft = fb.BeginTransaction())
             {
                 using (FbCommand fcon = new FbCommand(sql_func,fb,ft))
                 {
                     using (FbDataReader fr = fcon.ExecuteReader())
                     {
                         while (fr.Read())
                         {
                             res_ = true;
                         }
                         fr.Dispose();
                     }
                     fcon.Dispose();
                 }
                 ft.Commit();
                 ft.Dispose();
             }
         }
         catch { }
         finally { fb.Close(); }
         fb.Dispose();
     }
     return res_;
 }
开发者ID:nigihayami,项目名称:dataPump2.det,代码行数:32,代码来源:Check_.cs

示例12: DeleteTest

        public void DeleteTest()
        {
            string sql = "select * from TEST where int_field = @int_field";
            FbTransaction transaction = this.Connection.BeginTransaction();
            FbCommand command = new FbCommand(sql, Connection, transaction);
            FbDataAdapter adapter = new FbDataAdapter(command);
            adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

            adapter.SelectCommand.Parameters.Add("@int_field", FbDbType.Integer).Value = 10;

            FbCommandBuilder builder = new FbCommandBuilder(adapter);

            DataSet ds = new DataSet();
            adapter.Fill(ds, "TEST");

            Assert.AreEqual(1, ds.Tables["TEST"].Rows.Count, "Incorrect row count");

            ds.Tables["TEST"].Rows[0].Delete();

            adapter.Update(ds, "TEST");

            adapter.Dispose();
            builder.Dispose();
            command.Dispose();
            transaction.Commit();
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:26,代码来源:FbDataAdapterTests.cs

示例13: Listar

        public List<Indicador> Listar(string empresa, string filial)
        {
            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "SELECT EMPRESA, FILIAL, CODIGO, DESCRICAO FROM INDICADOR "+
                                         "WHERE ((INDICADOR.EMPRESA = @EMPRESA) OR (INDICADOR.EMPRESA = '**')) "+
                                         "AND ((INDICADOR.FILIAL = @FILIAL) OR (INDICADOR.FILIAL = '**'))";

                sqlCommand.Parameters.AddWithValue("@EMPRESA", empresa);
                sqlCommand.Parameters.AddWithValue("@FILIAL", filial);
                FbDataAdapter sqlAdapter = new FbDataAdapter();
                sqlAdapter.SelectCommand = sqlCommand;
                DataTable dtIndicador = new DataTable();
                sqlAdapter.Fill(dtIndicador);
                return this.ConverteDataTableEmList(dtIndicador).ToList();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }
        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:32,代码来源:IndicadorDAO.cs

示例14: SavePointTest

		public void SavePointTest()
		{
			FbCommand command = new FbCommand();

			Console.WriteLine("Iniciada nueva transaccion");

			Transaction = Connection.BeginTransaction("InitialSavePoint");

			command.Connection = Connection;
			command.Transaction = Transaction;

			command.CommandText = "insert into TEST (INT_FIELD) values (200) ";
			command.ExecuteNonQuery();

			Transaction.Save("FirstSavePoint");

			command.CommandText = "insert into TEST (INT_FIELD) values (201) ";
			command.ExecuteNonQuery();
			Transaction.Save("SecondSavePoint");

			command.CommandText = "insert into TEST (INT_FIELD) values (202) ";
			command.ExecuteNonQuery();
			Transaction.Rollback("InitialSavePoint");

			Transaction.Commit();
			command.Dispose();
		}
开发者ID:Outlivier,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:27,代码来源:FbTransactionTests.cs

示例15: AlterarSenha

        public void AlterarSenha(Usuario obj)
        {

            FbCommand sqlCommand = new FbCommand();

            try
            {
                sqlCommand.Connection = this._conexao;
                sqlCommand.CommandText = "UPDATE SYS_USERS SET USUARIOWEB = @USUARIO, SENHAWEB = @SENHA WHERE CODIGO  = @CODIGO";
                sqlCommand.Parameters.AddWithValue("@USUARIO", obj.NomeUsuario);
                sqlCommand.Parameters.AddWithValue("@SENHA", obj.Senha);
                sqlCommand.Parameters.AddWithValue("@CODIGO", obj.Codigo);
                sqlCommand.ExecuteNonQuery();
            }
            catch (FbException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                sqlCommand.Dispose();
            }
        }
开发者ID:PablusVinii,项目名称:OrdemServico,代码行数:27,代码来源:UsuarioDAO.cs


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