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


C# FbConnection.Close方法代码示例

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


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

示例1: 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

示例2: RettcDadosConstrucaoCivil

        public tcDadosConstrucaoCivil RettcDadosConstrucaoCivil(FbConnection Conn, string sNota)
        {

            try
            {
                StringBuilder sQuery = new StringBuilder();
                sQuery.Append("select coalesce(clifor.cd_art,'') Art, coalesce(clifor.cd_obra,'')CodigoObra {0}");
                sQuery.Append("from nf inner join clifor on nf.cd_clifor = clifor.cd_clifor {0}");
                sQuery.Append("where nf.cd_nfseq = '{1}' and nf.cd_empresa = '{2}' {0}");

                string sQueryEnd = string.Format(sQuery.ToString(), Environment.NewLine, sNota, belStatic.codEmpresaNFe);

                FbCommand cmd = new FbCommand(sQueryEnd, Conn);
                Conn.Open();
                FbDataReader dr = cmd.ExecuteReader();
                objtcDadosConstrucaoCivil = new tcDadosConstrucaoCivil();
                while (dr.Read())
                {
                    objtcDadosConstrucaoCivil.Art = dr["Art"].ToString();
                    objtcDadosConstrucaoCivil.CodigoObra = dr["CodigoObra"].ToString();
                }

            }
            catch (Exception)
            {
                throw;
            }
            finally { Conn.Close(); }


            return objtcDadosConstrucaoCivil;
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:32,代码来源:daoConstrucaoCivil.cs

示例3: Main

        static int Main(string[] args)
        {
            int i = 0;
            int max = args.Length < 1 ? 1 : int.Parse(args[0]);
            while (i < max)
            {
                var connectionBuilder = new FbConnectionStringBuilder();
                connectionBuilder.DataSource = "localhost";
                connectionBuilder.Database = @"D:\db\Hoge2.FDB";
                connectionBuilder.Charset = FbCharset.Utf8.ToString();
                connectionBuilder.UserID = "SYSDBA";
                connectionBuilder.Password = "masterkey";
                connectionBuilder.ServerType = FbServerType.Embedded;
                connectionBuilder.Pooling = false;

                using (var connection = new FbConnection(connectionBuilder.ConnectionString))
                {
                    connection.Open();
                    connection.Close();
                }
                i++;
            }
            UnloadDll(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), @"fbembed.dll"));
            return DateTime.Now.ToIntTime();
        }
开发者ID:kowill,项目名称:Sample,代码行数:25,代码来源:Program.cs

示例4: LoadAll

        internal override void LoadAll()
        {
            try
            {
                var cn = new FbConnection(_dbRoot.ConnectionString);
                cn.Open();
                string dbName = cn.Database;
                cn.Close();

                int index = dbName.LastIndexOfAny(new[] {'\\'});

                if (index >= 0)
                {
                    dbName = dbName.Substring(index + 1);
                }

                // We add our one and only Database
                var database = (FirebirdDatabase) dbRoot.ClassFactory.CreateDatabase();
                database._name = dbName;
                database.dbRoot = dbRoot;
                database.Databases = this;
                _array.Add(database);
            }
            catch {}
        }
开发者ID:attila3453,项目名称:alsing,代码行数:25,代码来源:Databases.cs

示例5: Conexao_Banco

        public Conexao_Banco(/*string _codigo*/)
        {
            InitializeComponent();

            aux_codigo = tx_pesquisa.Text;
            //this.aux_codigo = _codigo;
            /*string caminho = @"C:\Sistema de Registro da Producao Ambulatorial\FBCADASTRO_AGENDA.FDB";
            string conexao = "User=SYSDBA;"
                + "PassWord=masterkey;"
                + "DataBase=" + caminho;*/
            //DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=masterkey; DBNAME=MyServer/3051:C:\database\myData.fdb;
            // @"DataSource=localhost; Database=C:\PastaFireBird\BANCOFIREBIRD.FDB;";
            //User=SYSDBA; Password=masterkey; Database=D:\Meus Documentos\Faculdade - Esucri\Programação avançada I\Delphi com Banco\Banco\BANCO.FDB; DataSource=192.168.0.100;Dialect=3;PacketSize = 4096;"
            string conexao = @"User=SYSDBA;Password=masterkey;Database=C:\Sistema de Registro da Producao Ambulatorial\FBCADASTRO_AGENDA.FDB;DataSource=RECEPCAO;Port=3050;Dialect=3;PacketSize=4096";

            _fbConexao = new FbConnection(conexao);

            try
            {
                _fbConexao.Open();

            }
            catch (Exception erro)
            {

                MessageBox.Show(erro.ToString());
            }
            dtgrd_view.DataSource = _dtTable;
            _fbConexao.Close();
        }
开发者ID:ribeiroluis,项目名称:Listagem_ACS,代码行数:30,代码来源:Conexao_Banco.cs

示例6: BuscaDadosParaImpressao

        public List<belimpressao> BuscaDadosParaImpressao(List<belimpressao> objLista, FbConnection Conn)
        {
            try
            {
                for (int i = 0; i < objLista.Count; i++)
                {
                    StringBuilder sQuery = new StringBuilder();
                    sQuery.Append("select nf.cd_verificacao_nfse, nf.cd_numero_nfse from nf ");
                    sQuery.Append("where nf.cd_nfseq = '" + objLista[i].sNfSeq + "' and ");
                    sQuery.Append("nf.cd_empresa = '" + belStatic.codEmpresaNFe + "'");

                    FbCommand Command = new FbCommand(sQuery.ToString(), Conn);
                    if (Conn.State == System.Data.ConnectionState.Closed)
                    {
                        Conn.Open();
                    }
                    FbDataReader dr = Command.ExecuteReader();
                    dr.Read();
                    objLista[i].sNota = dr["cd_numero_nfse"].ToString();
                    objLista[i].sVerificacao = dr["cd_verificacao_nfse"].ToString();
                }
                if (Conn.State == System.Data.ConnectionState.Open)
                {
                    Conn.Close();
                }
                return objLista;
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:dramosti,项目名称:GeraXml_2.0,代码行数:33,代码来源:daoImpressao.cs

示例7: ExecuteBatchScript

        public static bool ExecuteBatchScript(
            string connectionString,
            string pathToScriptFile)
        {
            FbScript script = new FbScript(pathToScriptFile);
            if (script.Parse() > 0)
            {
                using (FbConnection connection = new FbConnection(connectionString))
                {
                    connection.Open();
                    try
                    {
                        FbBatchExecution batch = new FbBatchExecution(connection, script);
                        batch.Execute(true);

                    }
                    catch (FbException ex)
                    {
                        log.Error(ex);
                        throw new Exception(pathToScriptFile, ex);
                    }
                    finally
                    {
                        connection.Close();
                    }

                }

            }

            return true;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:32,代码来源:FBSqlHelper.cs

示例8: RetornaNomeUsuarioCadastrado

        public DataTable RetornaNomeUsuarioCadastrado(string prontuario)
        {
            FbConnection conex = new FbConnection(conexao);

            string query = "SELECT * FROM TBUSUARIO WHERE CDUSUARIO = '"+prontuario+"'";
            FbCommand comando = new FbCommand(query, conex);
            try
            {

                conex.Open();

                FbDataAdapter datareader = new FbDataAdapter(comando);
                DataTable usuarios = new DataTable();
                datareader.Fill(usuarios);
                return usuarios;
            }
            catch (Exception err)
            {

                throw err;
            }
            finally
            {
                conex.Close();
            }
        }
开发者ID:ribeiroluis,项目名称:SIGHOMEROGIL,代码行数:26,代码来源:AcessoFireBird.cs

示例9: 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

示例10: 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

示例11: OpenConnection

        public bool OpenConnection()
        {
            //// Set the ServerType to 1 for connect to the embedded server
            //string connectionString =
            //"User=SYSDBA;" +
            //"Password=masterkey;" +
            //"Database=C:/Users/ikhromov/Desktop/Domovoy_prj/4rmd.gdb;" +
            //"DataSource=localhost;" +
            //"Port=3050;" +
            //"Dialect=3;" +
            //"Charset=NONE;" +
            //"Role=;" +
            //"Connection lifetime=15;" +
            //"Pooling=true;" +
            //"MinPoolSize=0;" +
            //"MaxPoolSize=50;" +
            //"Packet Size=8192;" +
            //"ServerType=0";

            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["domovoyDBConnection"].ConnectionString;
                fbConnection = new FbConnection(connectionString);
                // Open connection.
                fbConnection.Open();
                fbConnection.Close();
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
开发者ID:Prizmer,项目名称:ps,代码行数:33,代码来源:DomovoyMeters.cs

示例12: LoadAll

		override internal void LoadAll()
		{
			try
			{
				FbConnection cn = new FirebirdSql.Data.FirebirdClient.FbConnection(this._dbRoot.ConnectionString);
				cn.Open();
				string dbName = cn.Database;
				cn.Close();

				int index = dbName.LastIndexOfAny(new char[]{'\\'});

				if (index >= 0)
				{
					dbName = dbName.Substring(index + 1);
				}

				// We add our one and only Database
				FirebirdDatabase database = (FirebirdDatabase)this.dbRoot.ClassFactory.CreateDatabase();
				database._name = dbName;
				database.dbRoot = this.dbRoot;
				database.Databases = this;
				this._array.Add(database);
			}
			catch {}
		}
开发者ID:nguyenhuuhuy,项目名称:mygeneration,代码行数:25,代码来源:Databases.cs

示例13: BeginTrasactionTest

		public void BeginTrasactionTest()
		{
			string connectionString = this.BuildConnectionString();

			FbConnection conn01 = new FbConnection(connectionString);
			conn01.Open();
			FbTransaction txn01 = conn01.BeginTransaction(IsolationLevel.Unspecified);
			txn01.Rollback();
			conn01.Close();

			FbConnection conn02 = new FbConnection(connectionString);
			conn02.Open();
			FbTransaction txn02 = conn02.BeginTransaction(IsolationLevel.ReadCommitted);
			txn02.Rollback();
			conn02.Close();

			FbConnection conn03 = new FbConnection(connectionString);
			conn03.Open();
			FbTransaction txn03 = conn03.BeginTransaction(IsolationLevel.ReadUncommitted);
			txn03.Rollback();
			conn03.Close();

			FbConnection conn04 = new FbConnection(connectionString);
			conn04.Open();
			FbTransaction txn04 = conn04.BeginTransaction(IsolationLevel.RepeatableRead);
			txn04.Rollback();
			conn04.Close();

			FbConnection conn05 = new FbConnection(connectionString);
			conn05.Open();
			FbTransaction txn05 = conn05.BeginTransaction(IsolationLevel.Serializable);
			txn05.Rollback();
			conn05.Close();
		}
开发者ID:masroore,项目名称:Firebird-NETProvider,代码行数:34,代码来源:FbConnectionTests.cs

示例14: execute

        public override void execute(Options options, INIManager iniManager)
        {
            string AppKey = iniManager.IniReadValue("APP", "AppKey");
            string AppSecret = iniManager.IniReadValue("APP", "AppSecret");
            string TaobaoAsistantPath = iniManager.IniReadValue("淘宝助理", "安装目录");

            string nick = options.Nick;
            string SessionKey = iniManager.IniReadValue(nick, "SessionKey");

            string userId = iniManager.IniReadValue(nick, "UserId");
            if (userId == null || userId.Trim().Equals(""))
            {
                userId = "1696293148";
            }

            StreamWriter MovePicLogWriter;

            FileStream MovePicLog = new FileStream(Environment.CurrentDirectory + "\\" + "MovePic.log", FileMode.Append);
            MovePicLogWriter = new StreamWriter(MovePicLog, Encoding.Default);
            FbConnectionStringBuilder cs = new FbConnectionStringBuilder();
            cs.Database = Path.Combine(TaobaoAsistantPath, "users\\" + nick + "\\APPITEM.DAT");
            cs.Charset = "UTF8";
            cs.UserID = "SYSDBA";
            cs.Password = "masterkey";
            cs.ServerType = FbServerType.Embedded;
            FbConnection fbCon = new FbConnection(cs.ToString());
            fbCon.Open();

            FbCommand ItemsCommand = null;
            ItemsCommand = new FbCommand("SELECT * FROM ITEM WHERE OUTER_ID = @SearchString OR TITLE = @SearchString", fbCon);
            FbParameter SearchString = new FbParameter("@SearchString", FbDbType.VarChar);
            SearchString.Value = options.Item;
            ItemsCommand.Parameters.Add(SearchString);

            FbDataReader ItemsReader = ItemsCommand.ExecuteReader();
            while (ItemsReader.Read())
            {
                MovePicLogWriter.WriteLine("--------------------------------------------------------------------------------");
                Console.WriteLine("--------------------------------------------------------------------------------");
                string ClientID = ItemsReader["CLIENT_ID"].ToString();
                string Title = ItemsReader["TITLE"].ToString();
                Console.WriteLine("ClientID=" + ClientID);
                MovePicLogWriter.WriteLine("ClientID=" + ClientID);
                Console.WriteLine("TITLE=" + Title);

                MovePicLogWriter.WriteLine("TITLE=" + Title);
                FbTransaction myTransaction = fbCon.BeginTransaction();
                FbCommand DeleteCommand = new FbCommand("UPDATE ITEM SET CLIENT_IS_DELETE = 1 WHERE CLIENT_ID = @ClientID", fbCon);
                FbParameter ParamID = new FbParameter("@ClientID", FbDbType.VarChar);
                ParamID.Value = ClientID;
                DeleteCommand.Parameters.Add(ParamID);
                DeleteCommand.Transaction = myTransaction;
                DeleteCommand.ExecuteNonQuery();
                myTransaction.Commit();
            }
            fbCon.Close();
            MovePicLogWriter.Close();
            MovePicLog.Close();
        }
开发者ID:kldcty,项目名称:movepic,代码行数:59,代码来源:DeleteItem.cs

示例15: EleentsToDataTable

 public static DataTable EleentsToDataTable(string command)
 {
     var dt = new DataTable();
     FbConnection con = new FbConnection(ConStr.ConnectionString);
     con.Open();
     FbDataAdapter da = new FbDataAdapter(command, con);
     da.Fill(dt);
     con.Close();
     return dt;
 }
开发者ID:GrzesiekK126,项目名称:Wrocasion,代码行数:10,代码来源:DatabaseUtils.cs


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