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


C# OracleDataReader.Close方法代码示例

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


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

示例1: Fill

        public bool Fill()
        {
            try {
                conn = new OracleConnection(GetConnectionString());
                conn.Open();
                transaction = conn.BeginTransaction();
            } catch (Exception e) {
                MessageBox.Show("При подключении к базе данных произошла ошибка:\n\n" + e.Message);
                conn.Close();
                conn.Dispose();
                return false;
            }

            cmd = conn.CreateCommand();
            cmd.CommandText = "SELECT TO_CHAR(id), l_name from akriko.cat_executors WHERE id in (SELECT distinct(ispolnitel_cik_id) FROM akriko.appeal) ORDER BY UPPER(l_name)";
            try {
                dr = cmd.ExecuteReader();
                while (dr.Read()) {
                    if (dr.IsDBNull(0) || dr.IsDBNull(1)) {
                        MessageBox.Show("При чтении данных из базы данных произошла ошибка:\n\n");
                        break;
                    } else {
                        UsersGrid.Rows.Add();
                        UsersGrid.Rows[UsersGrid.Rows.Count - 1].Cells["executor_id"].Value = dr.GetString(0);
                        UsersGrid.Rows[UsersGrid.Rows.Count - 1].Cells["akriko"].Value = dr.GetString(1);
                    }

                }
                dr.Close();
                dr.Dispose();
            } catch (Exception e) {
                MessageBox.Show("При чтении данных из базы данных произошла ошибка:\n\n" + e.Message);
            }
            if (UsersGrid.Rows.Count == 0) {
                MessageBox.Show("Отсутствуют неотконвертированные исполнители", "Конвертация исполнителей", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ConvertButton.Enabled = false;
            }
            FillDeloDepartmentsColumn();
            return true;
        }
开发者ID:timofeev-denis,项目名称:UserConverter,代码行数:40,代码来源:MainForm.cs

示例2: populate_list

        public DropDownList populate_list(DropDownList ddlistGen, string strSql, string strValue, string strText, string strExtraValue, string strExtraText)
        {
            objConnection = open_connection();
            if (open_con == true)
            {
                try
                {

                    objCommand = new OracleCommand(strSql, objConnection);
                    objDatareader = objCommand.ExecuteReader();
                    ddlistGen.DataSource = objDatareader;

                    ddlistGen.DataTextField = strText;
                    ddlistGen.DataValueField = strValue;
                    ddlistGen.DataBind();
                    objDatareader.Close();
                    objConnection.Close();
                    if (strExtraText != "")
                    {
                        ddlistGen.Items.Insert(0, new ListItem(strExtraText, strExtraValue));
                        ddlistGen.SelectedIndex = 0;
                    }

                    list_bind = true;
                    return ddlistGen;
                }
                catch (OracleException objError)
                {
                    if (objError.Message.Substring(0, 21) == "Table does not exist.")
                    {
                        ErrorStr = ErrorMsg(objConnection, "MSG1201");
                    }
                    if (objError.Message.Substring(59, 30) == "ORA-00904: invalid column name")
                    {
                        ErrorStr = ErrorMsg(objConnection, "MSG1202");
                    }
                    list_bind = false;
                    return null;
                }
                finally
                {
                    objCommand.Dispose();
                    objConnection.Close();
                    objConnection.Dispose();
                }
            }
            else
            {
                return null;
            }
        }
开发者ID:knkbhatia,项目名称:materialallocationatconstructionsite,代码行数:51,代码来源:OracleDataAccess.cs

示例3: FillDeloDepartmentsColumn

        private void FillDeloDepartmentsColumn()
        {
            ((DataGridViewComboBoxColumn)UsersGrid.Columns["delo"]).Items.Add("");
            cmd = conn.CreateCommand();
            cmd.CommandText = "select SUBSTR(p.due, 0, INSTR(p.due, '.', 3 )) departmentCode, p.due personCode, (SELECT d.classif_name FROM department d WHERE d.due = SUBSTR(p.due, 0, INSTR(p.due, '.', 3 ))) departmentName, classif_name from department p where DELETED=0 and due != '0.' order by due";
            try {
                dr = cmd.ExecuteReader();
                while (dr.Read()) {
                    if (!dr.IsDBNull(0)) {
                        ((DataGridViewComboBoxColumn)UsersGrid.Columns["delo"]).Items.Add(dr.GetString(3));
                        DeloPersons[dr.GetString(3)] = new DeloPerson(dr.GetString(0), dr.GetString(1), dr.GetString(2), dr.GetString(3));
                    }
                }

            } catch (Exception e) {
                MessageBox.Show("При чтении данных о подразделениях из базы данных произошла ошибка:\n\n" + e.Message);
            }
            if (dr != null) {
                dr.Close();
                dr.Dispose();
            }
            if (cmd != null) {
                cmd.Dispose();
            }
        }
开发者ID:timofeev-denis,项目名称:UserConverter,代码行数:25,代码来源:MainForm.cs

示例4: GetRegisseur

        public static Regisseur GetRegisseur(int id)
        {
            string naam = string.Empty;
            DateTime dob = new DateTime(1, 1, 1);
            string woonplek = string.Empty;
            int regisseurid = 0;
            List<Film> films = new List<Film>();
            List<Prijs> prijzen = new List<Prijs>();
            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT r.naam, r.dob, r.woonplek, r.regisseurid FROM regisseur r WHERE r.regisseurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", id);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        naam = reader.GetString(0);
                        dob = reader.GetDateTime(1);
                        woonplek = reader.GetString(2);
                        regisseurid = reader.GetInt32(3);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT p.titel, p.jaar, p.prizeid FROM prijs p, regisseurprijsregel rpr WHERE p.prizeid = rpr.prizeid AND rpr.regisseurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", id);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        prijzen.Add(new Prijs(reader.GetString(0), reader.GetInt32(1), reader.GetInt32(2)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT f.filmid, f.titel FROM film f, regisseur r WHERE r.regisseurid = :pid AND f.regisseurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", id);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        films.Add(new Film(reader.GetInt32(0).ToString(), reader.GetString(1)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }
            return new Regisseur(naam, dob, woonplek, prijzen, films, regisseurid);
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:87,代码来源:Database.cs

示例5: IsDataAvailable

        public bool IsDataAvailable(string strSql)
        {
            try
            {
                objConnection = open_connection();
                objCommand = new OracleCommand(strSql, objConnection);
                objDatareader = objCommand.ExecuteReader();
                if (objDatareader.HasRows)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (OracleException objError)
            {
                ErrorStr = objError.Message;
                //                    ErrorMsg(objConnection, "MSG1107");
                err_flag = true;
                return false;
            }
            finally
            {
                objConnection.Close();
                objDatareader.Close();
                objCommand.Dispose();

            }
        }
开发者ID:knkbhatia,项目名称:materialallocationatconstructionsite,代码行数:31,代码来源:OracleDataAccess.cs

示例6: ProcessNews

 public String ProcessNews()
 {
     using (Logger l = new Logger("PipeCatcher"))
     {
         OraCmd.CommandText = ProcName;
         OraCmd.CommandType = System.Data.CommandType.StoredProcedure;
         OraCmd.Parameters.Clear();
         //OraCmd.Parameters.Add(new OracleParameter("NRECID", OracleDbType.Decimal, System.Data.ParameterDirection.Input)).Value = RecId;
         OraCmd.Parameters.Add(new OracleParameter("REFCURSOR", OracleDbType.RefCursor, System.Data.ParameterDirection.Output));
         if (OraCmd.Connection.State != System.Data.ConnectionState.Closed)
         {
             OraCmd.Connection.Close();
         }
         OraCmd.Connection.Open();
         OraReader = OraCmd.ExecuteReader();
         var str = String.Format("\nCALL {0}", ProcName);
     //                var mainevt = new FlexEvent("PipeCatcher.Call." + ProcName);
     //                mainevt.Arguments.Add("@ProcName", ProcName);
         if (OraReader.HasRows)
         {
             var iRow = 0;
             FlexEvent evt = new FlexEvent("PipeCatcher.Call." + ProcName + ".Row." + (++iRow));
             str += "+++";
             while (OraReader.Read())
             {
                 for (int i = 0; i < OraReader.FieldCount; i++)
                 {
                     evt.Arguments.Add(OraReader.GetName(i), OraReader[i]);
                     str += "\n" + OraReader.GetName(i) + "\t: " + OraReader[i];
                 }
                 str += "\n********************";
     //                        mainevt.Arguments.Add(String.Format("Row{0}", ++iRow), evt);
                 Program.CoreGate.PushEvent(evt);
                 evt.Arguments.Clear();
             }
     //                    Program.CoreGate.PushEvent(mainevt);
         }
         else
         {
             str += "---";
         }
         OraReader.Close();
         l.msg(str);
         return str;
     }
 }
开发者ID:pulse-computer-consulting,项目名称:NucleusPub,代码行数:46,代码来源:DBReader.cs

示例7: MoveNextRelation

        private bool MoveNextRelation()
        {
            if (_relation_reader == null)
            {
                OracleCommand relation_command = new OracleCommand("select * from relation order by id");
                relation_command.Connection = _connection;
                _relation_reader = relation_command.ExecuteReader();
                if (!_relation_reader.Read())
                {
                    _relation_reader.Close();
                }
                OracleCommand relation_tag_command = new OracleCommand("select * from relation_tags order by relation_id");
                relation_tag_command.Connection = _connection;
                _relation_tag_reader = relation_tag_command.ExecuteReader();
                if (!_relation_tag_reader.IsClosed && !_relation_tag_reader.Read())
                {
                    _relation_tag_reader.Close();
                }
                OracleCommand relation_node_command = new OracleCommand("select * from relation_members order by relation_id,sequence_id");
                relation_node_command.Connection = _connection;
                _relation_member_reader = relation_node_command.ExecuteReader();
                if (!_relation_member_reader.IsClosed && !_relation_member_reader.Read())
                {
                    _relation_member_reader.Close();
                }
            }

            // read next relation.
            if (!_relation_reader.IsClosed)
            {
                // load/parse data.
                long id = _relation_reader.GetInt64(0);
                long changeset_id = _relation_reader.GetInt64(1);
                DateTime timestamp = _relation_reader.GetDateTime(2);
                bool visible = _relation_reader.GetInt64(3) == 1;
                long version = _relation_reader.GetInt64(4);
                string user = _relation_reader.GetString(5);
                long uid = _relation_reader.GetInt64(6);
                SimpleRelation relation = new SimpleRelation();
                relation.Id = id;
                relation.ChangeSetId = changeset_id;
                relation.TimeStamp = timestamp;
                relation.UserId = null;
                relation.UserName = null;
                relation.Version = (ulong)version;
                relation.Visible = visible;
                relation.UserName = user;
                relation.UserId = uid;

                if (!_relation_tag_reader.IsClosed)
                {
                    long returned_id = _relation_tag_reader.GetInt64(0);
                    while (returned_id == relation.Id.Value)
                    {
                        if (relation.Tags == null)
                        {
                            relation.Tags = new Dictionary<string, string>();
                        }
                        string key = _relation_tag_reader.GetString(1);
                        string value = _relation_tag_reader.GetString(2);

                        relation.Tags.Add(key, value);

                        if (!_relation_tag_reader.Read())
                        {
                            _relation_tag_reader.Close();
                            returned_id = -1;
                        }
                        else
                        {
                            returned_id = _relation_tag_reader.GetInt64(0);
                        }
                    }
                }
                if (!_relation_member_reader.IsClosed)
                {
                    long returned_id = _relation_member_reader.GetInt64(0);
                    while (returned_id == relation.Id.Value)
                    {
                        if (relation.Members == null)
                        {
                            relation.Members = new List<SimpleRelationMember>();
                        }
                        string member_type = _relation_member_reader.GetString(1);
                        long member_id = _relation_member_reader.GetInt64(2);
                        object member_role = _relation_member_reader.GetValue(3);

                        SimpleRelationMember member = new SimpleRelationMember();
                        member.MemberId = member_id;
                        if (member_role != DBNull.Value)
                        {
                            member.MemberRole = member_role as string;
                        }
                        switch (member_type)
                        {
                            case "Node":
                                member.MemberType = SimpleRelationMemberType.Node;
                                break;
                            case "Way":
                                member.MemberType = SimpleRelationMemberType.Way;
//.........这里部分代码省略.........
开发者ID:jorik041,项目名称:osmsharp,代码行数:101,代码来源:OracleSimpleDataProcessorSource.cs

示例8: ObtainRegisseurs

        public static List<ListItem> ObtainRegisseurs()
        {
            List<ListItem> regisseurList = new List<ListItem>();
            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT r.naam, r.regisseurid FROM regisseur r";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        regisseurList.Add(new ListItem(reader.GetString(0), reader.GetInt32(1).ToString()));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }
            return regisseurList;
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:28,代码来源:Database.cs

示例9: ValidateUser

        public static int ValidateUser(string email, string wachtwoord)
        {
            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT userid, gebruikersnaam FROM gebruiker WHERE gebruikersnaam = :pemail AND wachtwoord = :pwachtwoord";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("email", email);
                    cmd.Parameters.Add("wachtwoord", wachtwoord);
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        var emailCheck = reader.GetString(1);
                        if (emailCheck == email)
                        {
                            return reader.GetInt32(0);
                        }
                        cmd.Dispose();
                        connection.Dispose();
                        reader.Close();
                        return 0;
                    }
                    return 0;
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                    return 0;
                }
            }
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:38,代码来源:Database.cs

示例10: ObtainFilm

        public static Film ObtainFilm(string id)
        {
            Film _film;
            string titel = string.Empty;
            string beschrijving = string.Empty;
            Regisseur filmRegisseur = new Regisseur("test", 1);
            string genre = String.Empty;
            List<Prijs> filmPrijs = new List<Prijs>();
            List<Recensie> filmRecensies = new List<Recensie>();
            List<Acteur> cast = new List<Acteur>();
            double filmRating = 0;

            using (connection = new OracleConnection(connectionstring))
            {
                //string titel, string beschrijving, Regisseur filmRegisseur, string genre, List<Prijs> filmPrijs,
                //List<Recensie> filmRecensies, List<Acteur> cast, double filmRating
                query = "SELECT f.titel, f.beschrijving, r.naam, g.naam, r.regisseurid FROM film f, regisseur r, genre g, filmgenreregel fgr WHERE f.regisseurid = r.regisseurid AND f.filmid = :pid AND f.filmid = fgr.filmid AND fgr.genreid = g.genreid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        titel = reader.GetString(0);
                        beschrijving = reader.GetString(1);
                        filmRegisseur = new Regisseur(reader.GetString(2), reader.GetInt32(4));
                        genre = reader.GetString(3);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                //string titel, string beschrijving, Regisseur filmRegisseur, string genre, List<Prijs> filmPrijs,
                //List<Recensie> filmRecensies, List<Acteur> cast, double filmRating
                query = "SELECT AVG(r.ratingnumber) FROM rating r WHERE r.filmid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        filmRating = reader.GetInt32(0);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                //string titel, string beschrijving, Regisseur filmRegisseur, string genre, List<Prijs> filmPrijs,
                //List<Recensie> filmRecensies, List<Acteur> cast, double filmRating
                query = "SELECT a.naam, a.acteurid FROM acteur a, filmacteurregel facr, film f WHERE a.acteurid = facr.acteurid AND facr.filmid = :pid AND f.filmid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        cast.Add(new Acteur(reader.GetString(0), reader.GetInt32(1)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }
            using (connection = new OracleConnection(connectionstring))
            {
                //string titel, string beschrijving, Regisseur filmRegisseur, string genre, List<Prijs> filmPrijs,
                //List<Recensie> filmRecensies, List<Acteur> cast, double filmRating
                query = "SELECT p.titel, p.jaar, p.prizeid FROM prijs p, filmprijsregel fpr, film f WHERE p.prizeid = fpr.prizeid AND fpr.filmid = :pid AND f.filmid = :pid";
//.........这里部分代码省略.........
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:101,代码来源:Database.cs

示例11: ObtainFilms

        public static List<Film> ObtainFilms()
        {
            List<Film> films = new List<Film>();
            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT filmid, titel FROM film";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        int id = reader.GetInt32(0);
                        string titel = reader.GetString(1);
                        films.Add(new Film(id.ToString(), titel));
                    }
                    return films;
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                    return null;
                }
            }
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:31,代码来源:Database.cs

示例12: InsertUser

        public static bool InsertUser(string username, string password)
        {
            int id = 0;

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT MAX(userid) FROM gebruiker";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        id = reader.GetInt32(0);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                    return false;
                }
            }
            id = id + 1;
            using (connection = new OracleConnection(connectionstring))
            {
                query = "INSERT INTO gebruiker(userid, gebruikersnaam, wachtwoord) VALUES (:puserid, :pgebruikersnaam, :pwachtwoord)";
                cmd.CommandText = query;
                cmd.Connection = connection;
                connection.Open();
                try
                {
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("userid", id);
                    cmd.Parameters.Add("username", username);
                    cmd.Parameters.Add("password", password);
                    cmd.ExecuteNonQuery();
                    return true;
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                    return false;
                }
            }
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:53,代码来源:Database.cs

示例13: GetActeur

        public static Acteur GetActeur(string id)
        {
            string naam = string.Empty;
            DateTime dob = new DateTime(1, 1, 1);
            string woonplek = string.Empty;
            string baan = string.Empty;
            List<Prijs> prijzen = new List<Prijs>();
            List<Film> films = new List<Film>();

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT f.filmid, f.titel FROM film f, filmacteurregel fcr WHERE f.filmid = fcr.filmid AND fcr.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        films.Add(new Film(reader.GetInt32(0).ToString(), reader.GetString(1)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT p.titel, p.jaar, p.prizeid FROM acteurprijsregel apr, prijs p WHERE p.prizeid = apr.prizeid AND apr.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        prijzen.Add(new Prijs(reader.GetString(0), reader.GetInt32(1), reader.GetInt32(2)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT a.naam, a.dob, a.woonplek, a.baan FROM acteur a WHERE a.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        naam = reader.GetString(0);
                        dob = reader.GetDateTime(1);
                        woonplek = reader.GetString(2);
                        baan = reader.GetString(3);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }
            Acteur acteur = new Acteur(naam, dob, woonplek, baan, prijzen, films, Convert.ToInt32(id));
            return acteur;
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:89,代码来源:Database.cs

示例14: InsertRecensie

        public static bool InsertRecensie(int userid, int filmid, string body)
        {
            int id = 0;

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT MAX(reviewid) FROM recensie";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        id = reader.GetInt32(0);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                    return false;
                }
            }
            id = id + 1;
            using (connection = new OracleConnection(connectionstring))
            {
                query = @"INSERT INTO recensie (reviewid, userid, filmid, rbody) VALUES(:pid, :puserid, :pfilmid, :precensiebody)";
                cmd.CommandText = query;
                cmd.Connection = connection;
                connection.Open();
                try
                {
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", id);
                    cmd.Parameters.Add("userid", userid);
                    cmd.Parameters.Add("filmid", filmid);
                    cmd.Parameters.Add("recensiebody", body);
                    cmd.ExecuteNonQuery();
                    return true;
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                    return false;
                }
            }
        }
开发者ID:MaxKerst,项目名称:IMDb-Applicatie-Git,代码行数:54,代码来源:Database.cs

示例15: Backup

 void Backup(string executor_id)
 {
     cmd = conn.CreateCommand();
     cmd.CommandText = "select TO_CHAR(id) from akriko.appeal WHERE ISPOLNITEL_CIK_ID=" + executor_id;
     try {
         dr = cmd.ExecuteReader();
         while (dr.Read()) {
             if (!dr.IsDBNull(0)) {
                 this.Log(dr.GetString(0), executor_id);
             }
         }
     } catch (Exception e) {
         MessageBox.Show("При чтении данных о подразделениях из базы данных произошла ошибка:\n\n" + e.Message);
     }
     if (dr != null) {
         dr.Close();
         dr.Dispose();
     }
     if (cmd != null) {
         cmd.Dispose();
     }
 }
开发者ID:timofeev-denis,项目名称:UserConverter,代码行数:22,代码来源:MainForm.cs


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