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


C# OracleCommand.Dispose方法代码示例

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


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

示例1: CheckUseAcademicPositionName

        public bool CheckUseAcademicPositionName()
        {
            bool result = true;
            OracleConnection conn = ConnectionDB.GetOracleConnection();

            // Create the command
            OracleCommand command = new OracleCommand("SELECT count(ACAD_NAME) FROM TB_ACADEMIC_POSITION WHERE ACAD_NAME = :ACAD_NAME ", conn);

            // Add the parameters.
            command.Parameters.Add(new OracleParameter("ACAD_NAME", ACAD_NAME));
            try
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                int count = (int)(decimal)command.ExecuteScalar();
                if (count >= 1)
                {
                    result = false;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                command.Dispose();
                conn.Close();
            }
            return result;
        }
开发者ID:OAT-TUU-TANG-FIRST,项目名称:RMUTTO,代码行数:34,代码来源:Manage.cs

示例2: BlokkeerSegment

        public bool BlokkeerSegment(int spoorNr, int segmentNr)
        {
            var cmds = new OracleCommand("BLOKKEERSEGMENT", conn);
            cmds.CommandType = CommandType.StoredProcedure;

            cmds.Parameters.Add("p_spoorNr", OracleType.Number).Value = spoorNr;
            cmds.Parameters.Add("p_segmentNr", OracleType.Number).Value = segmentNr;

            cmds.Parameters.Add("p_geslaagd_out", OracleType.Number, 1);
            cmds.Parameters["p_geslaagd_out"].Direction = ParameterDirection.Output;

            OpenVerbinding();

            using (var da = new OracleDataAdapter(cmds))
            {
                cmds.ExecuteNonQuery();
            }

            //VERBINDING SLUITEN
            conn.Close();
            cmds.Dispose();

            //RETURN VALUE
            if (cmds.Parameters["p_geslaagd_out"].Value.ToString() == "1")
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:SvenHenderickx,项目名称:ICT4Rails-S22e,代码行数:32,代码来源:Database.cs

示例3: execQuery

        public OracleDataReader execQuery(string sql)
        {
            OracleCommand cmd = new OracleCommand(sql);
            OracleDataReader reader = null;

            cmd.Connection = conn;
            cmd.CommandType = CommandType.Text;

            try
            {

                reader = cmd.ExecuteReader();

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                cmd.Dispose();
            }

            return reader;
        }
开发者ID:RandomMinds,项目名称:WebAppToolkit,代码行数:25,代码来源:DataConnection.cs

示例4: createPost

        public void createPost(Member member)
        {
            try
            {

                String connstr = "Data source = studentoracle.students.ittralee.ie/orcl;User id = t00171832;Password=" + getPassword() + ";";
                OracleConnection conn = new OracleConnection(connstr);
                conn.Open();

                string query = "insert into posts values('" + member.Username + "', '" + member.Email + "' , " + member.Phone + " , :BlobParameter , '" + member.Image + "' , '"
                    + member.JoinDate + "' , " + member.MsgPrivate + " , '" + member.LastSeen  + ")";
                MessageBox.Show(query);
                //insert the byte as oracle parameter of type blob
                OracleParameter blobParameter = new OracleParameter();
                blobParameter.OracleType = OracleType.Blob;
                blobParameter.ParameterName = "BlobParameter";
                blobParameter.Value = member.Image;

                OracleCommand cmnd = new OracleCommand(query, conn);
                cmnd.Parameters.Add(blobParameter);
                cmnd.ExecuteNonQuery();
                cmnd.Dispose();
                conn.Close();
                conn.Dispose();
            }
            catch (Exception ex)
            {
            }
        }
开发者ID:LukeBluett,项目名称:PostBored,代码行数:29,代码来源:MemberDAOImpl.cs

示例5: ExecuteReader

 public static OracleDataReader ExecuteReader(string sqlStr, List<OracleParameter> parListOracleParameters)
 {
     OracleDataReader oracleDataReader = null;
     OracleConnection oracleConnection = new OracleConnection();
     oracleConnection.ConnectionString = OracleHelper.connectStr;
     try
     {
         if (oracleConnection.State != ConnectionState.Open)
         {
             oracleConnection.Open();
         }
         OracleCommand oracleCommand = new OracleCommand();
         oracleCommand.Connection = oracleConnection;
         oracleCommand.CommandText = sqlStr;
         for (int i = 0; i < parListOracleParameters.Count; i++)
         {
             oracleCommand.Parameters.Add(parListOracleParameters[i]);
         }
         oracleDataReader = oracleCommand.ExecuteReader(CommandBehavior.CloseConnection);
         oracleCommand.Dispose();
     }
     catch (Exception ex)
     {
         oracleDataReader.Close();
         oracleConnection.Close();
         throw ex;
     }
     return oracleDataReader;
 }
开发者ID:fiozhao,项目名称:DBCodeFirst,代码行数:29,代码来源:OracleHelper.cs

示例6: lbuSearch_Click

        protected void lbuSearch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSearchSeminarCitizen.Text))
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>แจ้งเตือน</strong></div>";
                notification.InnerHtml += "<div> - กรุณากรอกรหัสบัตรประชาชนในช่องคำค้นหา</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }
            if (txtSearchSeminarCitizen.Text.Length < 13)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>แจ้งเตือน</strong></div>";
                notification.InnerHtml += "<div> - กรุณากรอกรหัสบัตรประชาชนในช่องค้นหาให้ครบ 13 หลัก</div>";
                return;
            }
            else
            {
                notification.Attributes["class"] = "none";
                notification.InnerHtml = "";
            }

            string result = "";
            OracleConnection con2 = ConnectionDB.GetOracleConnection();
            OracleCommand com2 = new OracleCommand("SELECT CITIZEN_ID FROM TB_SEMINAR WHERE CITIZEN_ID = '" + txtSearchSeminarCitizen.Text + "'", con2);

            if (con2.State != ConnectionState.Open)
            {
                con2.Open();
            }
            OracleDataReader reader2 = com2.ExecuteReader();
            while (reader2.Read())
            {
                result = reader2.GetString(0);
            }

            if (result != txtSearchSeminarCitizen.Text)
            {
                notification.Attributes["class"] = "alert alert_danger";
                notification.InnerHtml = "";
                notification.InnerHtml += "<div><img src='Image/Small/red_alert.png' /><strong>แจ้งเตือน</strong></div>";
                notification.InnerHtml += "<div> - ไม่พบข้อมูลของรหัสบัตรประชาชนดังกล่าว</div>";
                return;
            }

            com2.Dispose();
            con2.Close();
        }
开发者ID:OAT-TUU-TANG-FIRST,项目名称:RMUTTO,代码行数:55,代码来源:Report-Seminar-ADMIN.aspx.cs

示例7: clearError

 public static void clearError(OracleSql db, int seqNo)
 {
     string version = getDatamodelVersion(db);
     Int32 error_count = 0;
     if (db.GetMetaConnection() != null)
     {
         string cmdQuery = "update " + sqlmakeRegistryTableName + " set path = 'CLEARED." + version + "', sdate_u=sysdate, suser_u='" + Environment.UserName + "@" + Environment.MachineName + "' where path = 'ERRORS." + version + "' and value = " + seqNo;
         OracleCommand cmd = new OracleCommand(cmdQuery, db.GetMetaConnection());
         error_count = cmd.ExecuteNonQuery();
         cmd.Dispose();
     }
     if (error_count == 0) { Log.ExitError("No error to clear"); }
     else Log.Info("clearError", "Error with sequence number {0} cleared", seqNo);
 }
开发者ID:chadclan,项目名称:sqlmake,代码行数:14,代码来源:RegistryTable.cs

示例8: Execute

        /// <summary>
        /// ����
        /// </summary>
        /// <param name="sql"></param>
        public static string Execute(string key, string sql, params OracleParameter[] pas)
        {
            string n;

            OracleConnection conn = null;
            OracleCommand cmd = null;

            try
            {
                conn = GetConnection(key);
                cmd = new OracleCommand();
                cmd.Connection = conn;
                conn.Open();
                cmd.CommandText = sql;
                cmd.Parameters.Clear();

                OracleParameter[] clonedParameters = new OracleParameter[pas.Length];
                //�⽫ִ��һ�������deep copy������������� ��Ȼ�����������ε�ʱ��ͻᱨ���
                for (int i = 0, j = pas.Length; i < j; i++)
                {
                    clonedParameters[i] = (OracleParameter)((ICloneable)pas[i]).Clone();
                }

                foreach (OracleParameter temppa in clonedParameters)
                {
                    cmd.Parameters.Add(temppa);
                }
                cmd.ExecuteNonQuery();
                n = cmd.Parameters[pas.Length - 1].Value.ToString();

            }
            catch (Exception e)
            {
                throw new DAOException(sql + "\n" + e.Message);
            }
            finally
            {
                try { cmd.Dispose(); conn.Close(); conn.Dispose(); }
                catch { }
            }
            return n;
        }
开发者ID:PeterLiuJF,项目名称:ProgrammerHome,代码行数:46,代码来源:OracleModel.cs

示例9: SetUp

		public void SetUp()
		{
			Exception exp = null;
			BeginCase("Setup");
			try
			{
				//prepare Data
				OracleCommand cmdPrepare = new OracleCommand("", new OracleConnection(MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString));
				cmdPrepare.Connection.Open();
				cmdPrepare.CommandText = "DELETE FROM Employees WHERE EmployeeID = 99999";
				cmdPrepare.ExecuteScalar();
				cmdPrepare.Connection.Close();
				cmdPrepare.Dispose();

				con = new OracleConnection(MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString);
				cmd = new OracleCommand("", con);
				con.Open();
			}
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:21,代码来源:OracleCommand_ExecuteNonQuery.cs

示例10: DELETE_PS_DISCIPLINARY_AND_AMNESTY

 public bool DELETE_PS_DISCIPLINARY_AND_AMNESTY()
 {
     bool result = false;
     OracleConnection conn = ConnectionDB.GetOracleConnection();
     OracleCommand command = new OracleCommand("Delete PS_DISCIPLINARY_AND_AMNESTY where PS_DAA_ID = :PS_DAA_ID", conn);
     try {
         if (conn.State != ConnectionState.Open) {
             conn.Open();
         }
         command.Parameters.Add(new OracleParameter("PS_DAA_ID", PS_DAA_ID));
         if (command.ExecuteNonQuery() >= 0) {
             result = true;
         }
     } catch (Exception ex) {
         throw ex;
     } finally {
         command.Dispose();
         conn.Close();
     }
     return result;
 }
开发者ID:OAT-TUU-TANG-FIRST,项目名称:RMUTTO,代码行数:21,代码来源:Personnel.cs

示例11: DeleteBySql

 //提交删除命令
 public override string DeleteBySql(string strsql)
 {
     try
     {
         this.CheckConn();
         OracleCommand cmdDel = new OracleCommand();
         OracleDataAdapter daDel = new OracleDataAdapter();
         int delrownum;
         cmdDel.Connection = MyConn;
         cmdDel.CommandText = strsql;
         daDel.DeleteCommand = cmdDel;
         delrownum = daDel.DeleteCommand.ExecuteNonQuery();
         cmdDel.Dispose();
         daDel.Dispose();
         return ("ok");
     }
     catch (Exception ex)
     {
         return (ex.Message);
     }
 }
开发者ID:LovingYao,项目名称:myProgram,代码行数:22,代码来源:DbOracle.cs

示例12: SetUp

		public void SetUp()
		{
			Exception exp = null;
			BeginCase("Setup");
			try
			{
				con = new OracleConnection(MonoTests.System.Data.Utils.ConnectedDataProvider.ConnectionString);
				con.Open();

				//prepare Data
				OracleCommand cmdPrepare = new OracleCommand("", con);
				cmdPrepare.CommandText = "DELETE FROM Employees WHERE EmployeeID = 99999";
				cmdPrepare.ExecuteNonQuery();
				cmdPrepare.CommandText = "INSERT INTO Employees (EmployeeID, FirstName, LastName) VALUES (99999,'OferXYZ', 'Testing')";
				cmdPrepare.ExecuteNonQuery();
				cmdPrepare.Dispose();

				cmd = new OracleCommand("", con);
			}
			catch(Exception ex)	{exp = ex;}
			finally	{EndCase(exp); exp = null;}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:22,代码来源:OracleCommand_ExecuteScalar.cs

示例13: ExecuteNonQuery

        public static string ExecuteNonQuery(string sql)
        {
            string ret = "false";
            try
            {
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = GetConnection();
                cmd.CommandText = sql;
                cmd.CommandType = CommandType.Text;
                cmd.CommandTimeout = 240;
                int r = cmd.ExecuteNonQuery();

                cmd.Connection.Close();
                cmd.Dispose();

                ret = "true";
            }
            catch (Exception ex)
            {
                ret = "false|Exception : " + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + "&SQL=" + sql;
            }
            return ret;
        }
开发者ID:TIT-tech,项目名称:OPM_BO,代码行数:23,代码来源:OPMOracleDb.cs

示例14: get_table_fileds

 /// <summary>
 /// ��ȡ�����ֶ�ֵ
 /// </summary>
 /// <param name="table_name">����</param>
 /// <param name="table_fileds">�ֶ�</param>
 /// <param name="where_fileds">��ѯ�����ֶ�</param>
 /// <param name="where_value">��ѯֵ</param>
 /// <returns></returns>
 public override string get_table_fileds(string table_name, string table_fileds, string where_fileds, string where_value)
 {
     where_value = Common.inSQL(where_value);
     string rStr = "";
     using (OracleConnection Conn = GetSqlConnection())
     {
         string strSql = string.Format("select {0} from {1} where upper({2})='{3}'", table_fileds, table_name.ToUpper(), where_fileds, where_value);
         OracleCommand cmd = new OracleCommand(strSql, Conn);
         cmd.CommandType = CommandType.Text;
         Conn.Open();
         OracleDataReader dr = cmd.ExecuteReader();
         if (dr.Read())
         {
             rStr = dr[0].ToString();
         }
         dr.Close();
         dr.Dispose();
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rStr;
 }
开发者ID:hezejiang,项目名称:EHR,代码行数:31,代码来源:OracleDataProvider.cs

示例15: AddData

        public int AddData(string strSQL)
        {
            int intReturn = 0;
            OracleConnection connection = null;
            OracleCommand command = null;
            try
            {
                connection = new OracleConnection(Connection.ConnectionString());
                command = new OracleCommand();
                command.CommandText = strSQL;
                command.Connection = connection;
                connection.Open();

                int intRowAffected = command.ExecuteNonQuery();

                connection.Close();

                if (intRowAffected > 0)
                {
                    return intReturn = intRowAffected;
                }
                else
                {
                    return intReturn;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (command != null) command.Dispose();
                if (connection != null && connection.State != ConnectionState.Closed) connection.Close();
            }
            return intReturn;
        }
开发者ID:raselahmmedgit,项目名称:simreg-sample,代码行数:37,代码来源:dllOracle.cs


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