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


C# FbConnection.Dispose方法代码示例

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


在下文中一共展示了FbConnection.Dispose方法的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: OpenConnection

        protected FbConnection OpenConnection()
        {
            CreateDatabase();

            var connection = new FbConnection(this.connString);
            try
            {
                connection.Open();
                return connection;
            }
            catch (Exception)
            {
                connection.Dispose();
                throw;
            }
        }
开发者ID:holinov,项目名称:BitSharp,代码行数:16,代码来源:SqlDataStorage.cs

示例3: TryConnect

 public bool TryConnect(int id)
 {
     bool _yes = false;
     try
     {
         var t = db.tModerator.Find(id);
         if (t != null)
         {
             FbConnectionStringBuilder fc = new FbConnectionStringBuilder();
             fc.Database = t.tModerator_database;
             fc.UserID = t.tModerator_userId;
             fc.Password = t.tModerator_password;
             fc.Pooling = false;
             fc.Charset = "win1251";
             using (FbConnection fb = new FbConnection(fc.ConnectionString))
             {
                 try
                 {
                     fb.Open();
                     _yes = true;
                 }
                 catch
                 {
                     _yes = false;
                 }
                 finally
                 {
                     fb.Close();
                 }
                 fb.Dispose();
             }
         }
     }
     catch
     {
         _yes = false;
     }
     return _yes;
 }
开发者ID:nigihayami,项目名称:TalismanSqlForum,代码行数:39,代码来源:ModeratorController.cs

示例4: SyncBranch

        static void SyncBranch(string username)
        {
            using (var db = new ApplicationDbContext())
            {
                var t = db.tModerator.First(a => a.tUsers.UserName == username);
                if (t != null)
                {
                    var fc = new FbConnectionStringBuilder
                    {
                        UserID = t.tModerator_userId,
                        Password = t.tModerator_password,
                        Database = t.tModerator_database,
                        Charset = "win1251",
                        Pooling = false,
                        Role = "R_ADMIN"
                    };

                    using (var fb = new FbConnection(fc.ConnectionString))
                    {
                        try
                        {
                            fb.Open();
                            using (var ft = fb.BeginTransaction())
                            {
                                using (var fcon = new FbCommand("select b.id_branch, b.mnemo from branch b", fb, ft))
                                {
                                    using (var fr = fcon.ExecuteReader())
                                    {
                                        while (fr.Read())
                                        {
                                            if (db.tBranch.Find(fr[0]) != null)
                                            {
                                                var m = db.tBranch.Find(fr[0]);
                                                m.tBranch_name = fr[1].ToString();
                                                db.Entry(m).State = System.Data.Entity.EntityState.Modified;
                                                db.SaveChanges();
                                            }
                                            else
                                            {
                                                var m = new tBranch { Id = (int)fr[0], tBranch_name = fr[1].ToString() };
                                                db.tBranch.Add(m);
                                                db.SaveChanges();
                                            }
                                        }
                                        fr.Dispose();
                                    }
                                    fcon.Dispose();
                                }
                                ft.Commit();
                                ft.Dispose();
                            }
                        }
                        catch
                        {
                            //Пропускаем все ошибки - сихн е удалась
                        }
                        finally
                        {
                            fb.Close();
                        }
                        fb.Dispose();
                    }
                }
                db.Dispose();
            }
        }
开发者ID:nigihayami,项目名称:TalismanSqlForum,代码行数:66,代码来源:AdminBtController.cs

示例5: try_connection

 public bool try_connection(string database)
 {
     bool yes_ = true;
     //в любом случае копируем базу!
     //возможно база находится на другом компутере
     //попробуем ее скопировать            
     //проверка соединения
         FbConnectionStringBuilder fc_ch = new FbConnectionStringBuilder();
         try
         {
             fc_ch.Database = Sett.Default.database_tmp ;//база, которую нужно конвертировать                
             fc_ch.Pooling = false; //пул соединения - отсутствует - для более быстрого освобождения базы
             fc_ch.ServerType = FbServerType.Embedded;//встроенный сервер
             fc_ch.ClientLibrary = ".\\fbembed.dll";
             //fc_old.Charset = "win1251"; //кодировка для FB 1/5 не указывается - здесь нужно было переводить в форматы UTF
             fc_ch.UserID = "sysdba";//пользователь по умолчанию
             fc_ch.Password = "masterkey"; //Пароль можно не указывать
         }
         catch (Exception ex)
         {
             yes_ = false;
             MessageBox.Show(ex.Message, "Неверные параметры подключения к базе", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         if (yes_)
         {
             using (FbConnection fb = new FbConnection(fc_ch.ConnectionString))
             {
                 try
                 {
                     fb.Open();
                 }
                 catch (FbException ex)
                 {
                     yes_ = false;
                     MessageBox.Show(ex.Message, "Ошибка при подключения к базе", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
                 finally
                 {
                     fb.Close();
                 }
                 fb.Dispose();
             }
         }
     return yes_;
 }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:45,代码来源:F99.cs

示例6: PREPARE_DATA

        public void PREPARE_DATA()
        {
            if (is_reserv(table_name))
            {
                table_name = "\"" + table_name + "\"";
            }
            using (FbConnection fb = new FbConnection(fc_old.ConnectionString))
            {
                try
                {
                    fb.Open();
                    using (FbTransaction ft = fb.BeginTransaction())
                    {
                        using (FbCommand fcon = new FbCommand(sql_data.Replace("@a", table_name), fb, ft))
                        {
                            fcon.Parameters.Add("@skip", FbDbType.Integer);
                            fcon.Parameters["@skip"].Value = skip_;
                            //дополнительные условия для отбора
                            switch (table_name.Trim().ToUpper())
                            {
                                case "DELETED":
                                    fcon.CommandText += " where Date_Deleted >= cast('NOW' as date) - 180";
                                    break;
                                case "ERR_LOG":
                                    fcon.CommandText += " where id_err_log is null";
                                    break;
                                case "BACKUP_LOG":
                                    fcon.CommandText += " where id_BACKUP_LOG is null";
                                    break;
                                case "SHADOWGUARD":
                                    fcon.CommandText += " where id_SHADOW is null";
                                    break;
                                case "USER_ACTIVITY":
                                    fcon.CommandText += " where id_user_activity is null";
                                    break;
                                case "MESSAGES":
                                    fcon.CommandText += " where lastdate >= cast('NOW' as date) - 100";
                                    break;
                                case "SCHEDULER":
                                    fcon.CommandText += " where id_status is null";
                                    break;
                                case "USER_CONNECTIONS":
                                    fcon.CommandText += " where ID_USER_CONNECTIONS is null";
                                    break;
                                case "REPORT_REPLICATION" :
                                    fcon.CommandText += " where DATE_CREATE >= cast('NOW' as date) - 30";
                                    break;
                            }
                            using (FbDataReader fr = fcon.ExecuteReader())
                            {
                                while (fr.Read())
                                {
                                    var sqlinsert = "insert into " + table_name + " values(";
                                    for (int t = 0; t <= fr.FieldCount - 1; t++)
                                    {
                                        if (sqlinsert != "insert into " + table_name + " values(")
                                        {
                                            sqlinsert += ",";
                                        }
                                        if (fr[t] == DBNull.Value)
                                        {
                                            sqlinsert += "null";
                                        }
                                        else
                                        {
                                            if (fr[t].GetType().ToString().ToUpper() == "SYSTEM.DOUBLE")
                                            {

                                                sqlinsert += fr[t].ToString().Replace(",", ".");
                                            }
                                            else
                                                //заменяем все ' на ''
                                                sqlinsert += "'" + fr[t].ToString().Replace("'", "''").Replace(" 0:00:00", " ") + "'";
                                        }
                                    }
                                    sqlinsert += ");";
                                    com2.Add(sqlinsert);
                                }
                                fr.Dispose();
                            }
                            fcon.Dispose();
                        }
                        ft.Commit();
                        ft.Dispose();
                    }
                }
                catch (FbException ex)
                {
                    sb.AppendLine("");
                    sb.AppendLine(ex.Message);
                }
                finally
                {
                    fb.Close();
                }
                fb.Dispose();
            }
        }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:98,代码来源:F99.cs

示例7: go_load

 public void go_load()
 {
     using (FbConnection fb = new FbConnection(fc_new.ConnectionString))
     {
         try
         {
             fb.Open();
             int _i = 0;
             int _j = q_data.Count;
             using (FbTransaction ft = fb.BeginTransaction())
             {
                 using (FbCommand fcon = new FbCommand("", fb, ft))
                 {
                     while (q_data.Count != 0)
                     {
                         _i++;
                         p_cur_2 = (int)(((float)_i / (float)_j) * 100);
                         p_text_2 = p_cur_2.ToString() + @"%";
                         fcon.CommandText = q_data.Dequeue();
                         fcon.ExecuteNonQuery();
                     }
                     fcon.Dispose();
                 }
                 ft.Commit();
                 ft.Dispose();
             }
         }
         catch (FbException ex)
         {
             sb.AppendLine("");
             sb.AppendLine(ex.Message);
         }
         finally
         {
             fb.Close();
         }
         fb.Dispose();
     }
 }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:39,代码来源:F99.cs

示例8: execute_com

        public void execute_com()
        {
            using (FbConnection fb = new FbConnection(fc_new.ConnectionString))
            {                
                string last_com = "";
                try
                {
                    fb.Open();

                    int i = 0;
                    int j = com.Count;
                    using (FbTransaction ft = fb.BeginTransaction())
                    {
                        foreach (string cmd in com)
                        {
                            last_com = cmd;
                            i++;
                            p_cur = (int)(((float) i / (float) j) * 100);
                            p_text = i.ToString() + "/" + j.ToString();
                        
                            using (FbCommand fcon = new FbCommand(cmd, fb,ft))
                            {
                                
                                try
                                {
                                    fcon.ExecuteNonQuery();
                                }
                                catch(FbException ex)
                                {
                                    sb.AppendLine("**********");
                                    sb.AppendLine(ex.Message);
                                    sb.AppendLine("**********");
                                    sb.AppendLine(cmd);
                                }
                                fcon.Dispose();
                            }
                        }
                      ft.Commit();
                        ft.Dispose();
                    }
                }
                catch (FbException ex)
                {
                    sb.AppendLine("EXECUTE COM");
                    sb.AppendLine(ex.Message);
                    sb.AppendLine("**********Command");
                    sb.AppendLine(last_com);
                }
                finally
                {
                    fb.Close();
                }
                fb.Dispose();
            }
        }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:55,代码来源:F99.cs

示例9: m_GENERATORS

 public void m_GENERATORS()
 {
     using (FbConnection fb = new FbConnection(fc_old.ConnectionString))
     {
         try
         {
             fb.Open();
             using (FbTransaction ft = fb.BeginTransaction())
             {
                 using (FbCommand fcon = new FbCommand(sql_GENERATORS, fb, ft))
                 {
                     using (FbDataReader fr = fcon.ExecuteReader())
                     {
                         while (fr.Read())
                         {
                             //основа
                             string dll_command = "CREATE GENERATOR " + fr[0].ToString() + "\n";
                             //теперь значение
                             string dll_val = "";
                             using (FbCommand fcon_a = new FbCommand(sql_GENERATORS_VAL.Replace("@a", fr[0].ToString()), fb, ft))
                             {
                                 using (FbDataReader fr_a = fcon_a.ExecuteReader())
                                 {
                                     while (fr_a.Read())
                                     {
                                         dll_val = "SET GENERATOR " + fr[0].ToString() + " TO " + fr_a[0].ToString();
                                     }
                                     fr_a.Dispose();
                                 }
                                 fcon_a.Dispose();
                             }
                             //добавляем наши команды
                             com_generators.Add(dll_command);
                             com_generators.Add(dll_val);
                         }
                         fr.Dispose();
                     }
                 }
                 ft.Commit();
                 ft.Dispose();
             }
         }
         catch (FbException ex)
         {
             sb.AppendLine("GENERATORS");
             sb.AppendLine(ex.Message);
         }
         finally
         {
             fb.Close();
         }
         fb.Dispose();
     }
 }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:54,代码来源:F99.cs

示例10: m_DOMAINS

 public void m_DOMAINS()
 {
     using (FbConnection fb = new FbConnection(fc_old.ConnectionString))
     {
         try
         {
             fb.Open();
             using (FbTransaction ft = fb.BeginTransaction())
             {
                 using (FbCommand fcon = new FbCommand(sql_domains, fb, ft))
                 {
                     using (FbDataReader fr = fcon.ExecuteReader())
                     {
                         while (fr.Read())
                         {
                             //основа
                             string dll_command = "create domain " + fr[0].ToString() + "\n" + "as" + "\n";
                             //теперь тип данных
                             dll_command += get_field_type(fr[10].ToString(), fr[8].ToString(), fr[9].ToString(), fr[11].ToString(), fr[17].ToString(), fr[27].ToString()) + "\n";
                             //есть ли у него Character set
                             if (fr[28].ToString() != DBNull.Value.ToString())
                             {
                                 dll_command += " character set " + fr[28].ToString() + "\n";
                             }
                             //дальше идет значение DEFAULT
                             if (fr[7].ToString() != DBNull.Value.ToString())
                             {
                                 dll_command += fr[7].ToString() + "\n";
                             }
                             //проверка
                             if (fr[3].ToString() != DBNull.Value.ToString())
                             {
                                 dll_command += fr[3].ToString() + "\n";
                             }
                             //COLLATE
                             if (fr[29].ToString() != DBNull.Value.ToString())
                             {
                                 dll_command += fr[29].ToString() + "\n";
                             }
                             //записываем
                             com_domains.Add(dll_command);
                         }
                         fr.Dispose();
                     }
                     fcon.Dispose();
                 }
                 ft.Commit();
                 ft.Dispose();
             }
         }
         catch (FbException ex)
         {
             sb.AppendLine("DOMAINS");
             sb.AppendLine(ex.Message);
         }
         finally
         {
             fb.Close();
         }
         fb.Dispose();
     }
 }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:62,代码来源:F99.cs

示例11: m_UDF

        public void m_UDF()
        {
            using (FbConnection fb = new FbConnection(fc_old.ConnectionString))
            {
                try
                {
                    fb.Open();
                    using (FbTransaction ft = fb.BeginTransaction())
                    {
                        try
                        {
                            //сформируем список функций - их создание
                            using (FbCommand fcon = new FbCommand(sql_udf, fb, ft))
                            {
                                using (FbDataReader fr = fcon.ExecuteReader())
                                {
                                    while (fr.Read())
                                    {
                                        //будующая заготовка
                                        string dll_command = "DECLARE EXTERNAL FUNCTION " + fr[0].ToString().Trim();
                                        //будующий возврат
                                        string dll_return = "RETURNS ";
                                        //оконцовка
                                        string dll_end = "ENTRY_POINT '" + fr[5].ToString().Trim() + "'" + " MODULE_NAME '" + fr[4].ToString() + "'";
                                        //Теперь нам нужны возвращаемые параметры
                                        string dll_argument = "";
                                        #region Формирование аргументов
                                        using (FbCommand fcon_a = new FbCommand(sql_udf_a, fb, ft))
                                        {
                                            fcon_a.Parameters.Add("@a", FbDbType.VarChar, 31);
                                            fcon_a.Parameters[0].Value = fr[0].ToString();
                                            using (FbDataReader fr_a = fcon_a.ExecuteReader())
                                            {
                                                while (fr_a.Read())
                                                {
                                                    if (fr_a[0].ToString() == fr[6].ToString())
                                                    {
                                                        if (fr[6].ToString() == "0")
                                                        {
                                                            //Значит выходной
                                                            dll_return += get_field_type(fr_a[2].ToString(), fr_a[4].ToString(), fr_a[3].ToString(), fr_a[5].ToString(), "0", fr_a[8].ToString(), true);
                                                            //теперь как значение или как ссылка
                                                            if (fr_a[1].ToString() == "-1")
                                                            {
                                                                //FREE_IT
                                                                dll_return += " FREE_IT";
                                                            }
                                                            else
                                                                if (fr_a[1].ToString() == "0")
                                                                {
                                                                    dll_return += " BY VALUE";
                                                                }
                                                        }
                                                        else
                                                        {
                                                            dll_return += "PARAMETER " + fr_a[0].ToString();
                                                            if (dll_argument == "")
                                                                dll_argument += get_field_type(fr_a[2].ToString(), fr_a[4].ToString(), fr_a[3].ToString(), fr_a[5].ToString(), "0", fr_a[8].ToString(), true);
                                                            else
                                                            {
                                                                dll_argument += "," + "\n" + get_field_type(fr_a[2].ToString(), fr_a[4].ToString(), fr_a[3].ToString(), fr_a[5].ToString(), "0", fr_a[8].ToString(), true);
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        //а вот теперь начнем формировать строку создания
                                                        if (dll_argument == "")
                                                            dll_argument += get_field_type(fr_a[2].ToString(), fr_a[4].ToString(), fr_a[3].ToString(), fr_a[5].ToString(), "0", fr_a[8].ToString(), true);
                                                        else
                                                        {
                                                            dll_argument += "," + "\n" + get_field_type(fr_a[2].ToString(), fr_a[4].ToString(), fr_a[3].ToString(), fr_a[5].ToString(), "0", fr_a[8].ToString(), true);
                                                        }
                                                    }
                                                }
                                                fr_a.Dispose();
                                            }
                                            fcon_a.Dispose();
                                        }
                                        #endregion
                                        //и вот она наша собранная строка 
                                        dll_command += "\n" + dll_argument + "\n" + dll_return + "\n" + dll_end;
                                        dll_command = regexTrim.Replace(dll_command, "TRIM_");
                                        dll_command = regexIIF.Replace(dll_command, "IIF_");
                                        //теперь добавим ее в список команд
                                        com_udf.Add(dll_command);
                                    }
                                    fr.Dispose();
                                }
                                fcon.Dispose();
                            }
                        }
                        catch (FbException ex2)
                        {
                            MessageBox.Show(ex2.Message);
                        }
                        ft.Commit();
                    }
                }
                catch (FbException ex)
//.........这里部分代码省略.........
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:101,代码来源:F99.cs

示例12: run_user

 public void run_user()
 {
     using (FbConnection fb = new FbConnection(fc_new.ConnectionString))
     {
         try
         {
             fb.Open();
             using (FbTransaction ft = fb.BeginTransaction())
             {
                 using (FbCommand fcon = new FbCommand(sql_user, fb, ft))
                 {
                     using (FbDataReader fr = fcon.ExecuteReader())
                     {
                         while (fr.Read())
                         {
                             fb_add(fr[0].ToString(), this.t_pass.Text, false, null);
                         }
                     }
                     fcon.Dispose();
                 }
                 ft.Dispose();
             }
         }
         catch { }
         finally { fb.Close(); }
         fb.Dispose();
     }
 }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:28,代码来源:F99.cs

示例13: Init

 /// <summary>
 /// Осуществляет инициализацию работы с БД службы.
 /// </summary>
 public static void Init()
 {
     // Инициализируем подключение к базе данных
     _DB_FullFileName = AppDomain.CurrentDomain.BaseDirectory + "DEVICES.FB";
     _DB_ClientLibraryPath = AppDomain.CurrentDomain.BaseDirectory + "fbdb\\fbembed.dll";
     try
     {
         // Задаем параметры подключения
         FbConnectionStringBuilder conn_str = new FbConnectionStringBuilder();
         conn_str.ServerType = FbServerType.Embedded;
         conn_str.Charset = "WIN1251";
         conn_str.Dialect = 3;
         conn_str.Role = "";
         conn_str.Database = _DB_FullFileName;
         //conn_str.DataSource = "localhost";
         //conn_str.Port = 3050;
         //conn_str.ConnectionLifeTime = 0;
         //conn_str.Pooling = true;
         //conn_str.MinPoolSize = 0;
         //conn_str.MaxPoolSize = 50;
         conn_str.UserID = _DB_Login;
         conn_str.Password = _DB_Paswd;
         conn_str.ClientLibrary = _DB_ClientLibraryPath;
         conn_str.PacketSize = 16384;
         // Создаем подключение к БД
         FB_dbConnection = new FbConnection(conn_str.ToString());
         // Инициализируем и задаем параметры транзакций
         FB_dbReadTransactionOptions = new FbTransactionOptions();
         FB_dbReadTransactionOptions.TransactionBehavior = FbTransactionBehavior.Read | FbTransactionBehavior.ReadCommitted | FbTransactionBehavior.RecVersion;
         FB_dbCommitTransactionOptions = new FbTransactionOptions();
         FB_dbCommitTransactionOptions.TransactionBehavior = FbTransactionBehavior.NoWait | FbTransactionBehavior.ReadCommitted | FbTransactionBehavior.RecVersion;
     }
     catch (Exception exc)
     {
         // Делаем запись в журнал событий
         WinLog.Write(string.Format("Ошибка инициализации БД: ", exc.Message), System.Diagnostics.EventLogEntryType.Error);
         // Освобождаем ресурсы
         if (FB_dbConnection != null)
             FB_dbConnection.Dispose();
         FB_dbConnection = null;
     }
     // Устанавливаем признак того, что в данный момент транзакций нет
     IsLockedTransaction = false;
 }
开发者ID:Brabys2012,项目名称:SmartHouse,代码行数:47,代码来源:SQL.cs

示例14: CreateOffer

        public ActionResult CreateOffer(CreateOffer t)
        {
            int doc_number = 0;
            var tu = db.Users.Where(a => a.UserName == User.Identity.Name).First().tModerator;
            if (tu.Count != 0)
            {
                FbConnectionStringBuilder fc = new FbConnectionStringBuilder();
                fc.Database = tu.First().tModerator_database;
                fc.UserID = tu.First().tModerator_userId;
                fc.Password = tu.First().tModerator_password;
                fc.Role = "R_ADMIN";
                fc.Pooling = false;
                fc.Charset = "win1251";
                using (FbConnection fb = new FbConnection(fc.ConnectionString))
                {
                    try
                    {
                        fb.Open();
                        using (FbTransaction ft = fb.BeginTransaction())
                        {

                            using (FbCommand fcon = new FbCommand("select G.NUM " +
            "from GET_DC_DOCUMENT_NUMBER(85) G", fb, ft))
                            {
                                using (FbDataReader fr = fcon.ExecuteReader())
                                {
                                    while (fr.Read())
                                    {
                                        doc_number = (int)fr[0];
                                    }
                                    fr.Dispose();
                                }
                                fcon.Dispose();
                            }

                            var _com = "execute procedure IUD_BUGS('I', null, @IS_ERROR, @LOCATION, @ID_RELEASE_PROJECTS, @ID_RELEASE_PROJECTS_EXEC," +
                            " null, null, @ID_SUBSYSTEM," +
                            "@ID_BRANCH, null, 85, 1, (select list_id from sel_filter_budg(2)),@DOC_NUMBER, 'NOW'," +
                            "null, @comment, null, @DETAIL_COMMENT, 1, @ID_PROJECTS, null,null) ";
                            using (FbCommand fcon = new FbCommand(_com, fb, ft))
                            {

                                switch (t._iserror)
                                {
                                    case true:
                                        fcon.Parameters.AddWithValue("@IS_ERROR", '1');
                                        break;
                                    default:
                                        fcon.Parameters.AddWithValue("@IS_ERROR", '0');
                                        break;
                                }
                                fcon.Parameters.AddWithValue("@LOCATION", t._location);
                                fcon.Parameters.AddWithValue("@ID_RELEASE_PROJECTS", t.id_release_projects);
                                fcon.Parameters.AddWithValue("@ID_RELEASE_PROJECTS_EXEC", t.id_release_projects_exec);
                                fcon.Parameters.AddWithValue("@ID_SUBSYSTEM", t.id_subsystem);
                                fcon.Parameters.AddWithValue("@ID_BRANCH", t.id_branch);
                                if (t._message.Id != 0)
                                {
                                    var val = this.Url.RequestContext.HttpContext.Request.Url.Scheme;
                                    fcon.Parameters.AddWithValue("@comment", t._message.tForumThemes.tForumThemes_name);
                                    fcon.Parameters.AddWithValue("@DETAIL_COMMENT",
                                        "<em><a href ='" +
                                       Url.Action("Index", "ForumMessages", new { id = t._message.tForumThemes.Id, id_list = t._message.tForumThemes.tForumList.Id }, val) +
                                        "'> " +
                                       Url.Action("Index", "ForumMessages", new { id = t._message.tForumThemes.Id, id_list = t._message.tForumThemes.tForumList.Id }, val) +
                                       "</a></em>" +
                                        "<p>" + t._message.tForumMessages_messages + "</p>");
                                }
                                else
                                {
                                    var val = this.Url.RequestContext.HttpContext.Request.Url.Scheme;

                                    fcon.Parameters.AddWithValue("@comment", t._themes.tForumThemes_name);
                                    fcon.Parameters.AddWithValue("@DETAIL_COMMENT",
                                        "<em><a href ='" +
                                        Url.Action("Index", "ForumMessages", new { id = t._themes.Id, id_list = t._themes.tForumList.Id }, val) +
                                        "'> " +
                                        Url.Action("Index", "ForumMessages", new { id = t._themes.Id, id_list = t._themes.tForumList.Id }, val) +
                                        "</a></em>" +
                                        "<p>" + t._themes.tForumThemes_desc + "</p>");
                                }

                                fcon.Parameters.AddWithValue("@ID_PROJECTS", t.id_projects);

                                fcon.Parameters.AddWithValue("@DOC_NUMBER", doc_number);
                                try
                                {
                                    fcon.ExecuteNonQuery();
                                    ft.Commit();
                                }
                                catch (FbException ex1)
                                {
                                    ModelState.AddModelError("", ex1.Message);
                                    ft.Rollback();
                                }
                                finally
                                {
                                    fcon.Dispose();
                                }
                            }
//.........这里部分代码省略.........
开发者ID:nigihayami,项目名称:TalismanSqlForum,代码行数:101,代码来源:ModeratorController.cs

示例15: m_FOREIGN_KEY

        public void m_FOREIGN_KEY()
        {
            using (FbConnection fb = new FbConnection(fc_old.ConnectionString))
            {
                try
                {
                    fb.Open();
                    using (FbTransaction ft = fb.BeginTransaction())
                    {
                        using (FbCommand fcon = new FbCommand(sql_foreign_key, fb, ft))
                        {
                            using (FbDataReader fr = fcon.ExecuteReader())
                            {
                                while (fr.Read())
                                {
                                    string dll_command = "";
                                    dll_command += fr[0].ToString();
                                    if (is_reserv(fr[1].ToString().Trim()))
                                    {
                                        dll_command += "\"" + fr[1].ToString().Trim() + "\"";
                                    }
                                    else
                                    {
                                        dll_command += fr[1].ToString().Trim();
                                    }
                                    dll_command += fr[2].ToString();
                                    if (is_reserv(fr[3].ToString().Trim()))
                                    {
                                        dll_command += "\"" + fr[3].ToString().Trim() + "\"";
                                    }
                                    else
                                    {
                                        dll_command += fr[3].ToString().Trim();
                                    }
                                    dll_command += fr[4].ToString();

                                    com_foreign_key.Add(dll_command);
                                }
                                fr.Dispose();
                            }
                            fcon.Dispose();
                        }
                        ft.Commit();
                        ft.Dispose();
                    }
                }
                catch (FbException ex)
                {
                    sb.AppendLine("");
                    sb.AppendLine(ex.Message);
                }
                finally
                {
                    fb.Close();
                }
                fb.Dispose();
            }
        }
开发者ID:nigihayami,项目名称:dataPump.det,代码行数:58,代码来源:F99.cs


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