當前位置: 首頁>>代碼示例>>C#>>正文


C# Database.Dispose方法代碼示例

本文整理匯總了C#中UDS.Components.Database.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# Database.Dispose方法的具體用法?C# Database.Dispose怎麽用?C# Database.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UDS.Components.Database的用法示例。


在下文中一共展示了Database.Dispose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Delete

        /// <summary>
        /// ɾ��ijĿ¼
        /// </summary>
        /// <param name="ClassID">��ĿID</param>
        public void Delete(int ClassID)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@TeamID" , SqlDbType.Int, 20, ClassID),
            };
            try
            {
                data.RunProc("sp_DeleteTeam", prams);
            }

            catch (Exception ex)
            {
                Error.Log(ex.ToString());

            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:29,代碼來源:Directory.cs

示例2: AddClass

        /// <summary>
        /// ��Ŀ¼�ڵ�
        /// </summary>
        /// <param name="ClassID">��Ŀ¼�ڵ�</param>
        /// <returns>��Ŀ¼�ڵ�</returns>
        public void AddClass(int ParentID, string ClassName, string ClassRemark, int ClassType, string AddedBy, DateTime AddedDate, int Status)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@ClassParentID" , SqlDbType.Int, 20, ParentID),
                                       data.MakeInParam("@ClassName" , SqlDbType.NVarChar, 20, ClassName),
                                       data.MakeInParam("@ClassRemark" , SqlDbType.NVarChar, 400, ClassRemark),
                                       data.MakeInParam("@ClassType" , SqlDbType.Int, 1, ClassType),
                                       data.MakeInParam("@AddedBy" , SqlDbType.NVarChar, 40, AddedBy),
                                       data.MakeInParam("@AddedDate" , SqlDbType.DateTime, 30, AddedDate),
                                       data.MakeInParam("@Status" , SqlDbType.Int, 1, Status)
                                   };

            try
            {
                data.RunProc("sp_AddTeam", prams);

            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("Ŀ¼��ӳ���", ex);
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:37,代碼來源:Class.cs

示例3: AddBoardMaster

 public void AddBoardMaster(int boardid, int staffid)
 {
     Database data = new Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@BoardID",  SqlDbType.Int, 4,boardid),
                                data.MakeInParam("@StaffID",  SqlDbType.Int, 4,staffid)
                            };
     try
     {
         data.RunProc("sp_BBS_SetupBoardMaster", prams);
     }
     finally
     {
         if (data != null)
         {
             data.Close();
             data.Dispose();
         }
     }
 }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:20,代碼來源:BBS.cs

示例4: GetRealNameByUsername

        /// <summary>
        /// ��ȡ�û�������Ϣ
        /// </summary>
        /// <param name="Username">�û�����</param>
        /// <returns>������ʵ����</returns>
        public static string GetRealNameByUsername(string Username)
        {
            SqlDataReader dataReader = null;
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@Username",    SqlDbType.NVarChar, 30, Username),

            };
            try
            {
                // run the stored procedure
                data.RunProc("sp_GetRealNameByUsername",prams,out dataReader);
                if(dataReader.Read())
                {

                    return dataReader[0].ToString();

                }
                else
                {

                    return "";

                }

            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("��Ա��Ϣ��ȡ����!",ex);
            }
            finally
            {
                dataReader.Close();
                data.Dispose();

            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:43,代碼來源:Staff.cs

示例5: AddBBSCatalog

 //string CatalogName,string CatalogDescription
 //給uds_bbs_catalog表,新增記錄
 public bool AddBBSCatalog(BBSCatalog BBSCatalog)
 {
     //參數 CatalogName 表示BBS中的title , 參數 CatalogDescription 表示BBS中的content
     //給存儲過程傳遞參數
     Database data = new Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@title",  SqlDbType.VarChar, 300, BBSCatalog.CatalogName),
                                data.MakeInParam("@content", SqlDbType.NText, 16, BBSCatalog.CatalogDescription),
     };
     try
     {
         data.RunProc("sp_BBS_AddCatalog", prams);
     }
     finally
     {
         if (data != null)
         {
             data.Close();
             data.Dispose();
         }
     }
     return true;
 }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:25,代碼來源:BBS.cs

示例6: Add

        /// <summary>
        /// Ŀ¼���
        /// </summary>
        public void Add(int ParentID,string ProjectName,string ProjectRemark,string Wright,int Status,int Scale,DateTime StartDate,DateTime EndDate)
        {
            // �������ݿ�����༰DataReader
            Database data = new Database();

            // ִ�д洢���̣�������SqlDataReader����
            SqlParameter[] prams = {
                                       data.MakeInParam("@ParentID" , SqlDbType.Int, 20, ParentID),
                                       data.MakeInParam("@ProjectName" , SqlDbType.NVarChar, 20, ProjectName),
                                       data.MakeInParam("@ProjectRemark" , SqlDbType.NVarChar, 400, ProjectRemark),
                                       data.MakeInParam("@Wright" , SqlDbType.NVarChar, 40, Wright),
                                       data.MakeInParam("@Status" , SqlDbType.Int, 40, Status),
                                       data.MakeInParam("@Scale" , SqlDbType.Int, 20, Scale),
                                       data.MakeInParam("@StartDate" , SqlDbType.DateTime, 30, StartDate),
                                       data.MakeInParam("@EndDate" , SqlDbType.DateTime, 30, EndDate)
                                   };

            try
            {
                data.RunProc("sp_AddProject",prams);

            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("��Ŀ��ӳ���",ex);
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
                data	   = null;
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:40,代碼來源:Directory.cs

示例7: DocDelete

        /// <summary>
        /// ɾ��һ���ĵ�
        /// </summary>
        /// <param name="MailIDStr">�ĵ�ID�������ַ������ö�������</param>
        public bool DocDelete(string DocIDStr,int DeleteType)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@DocIDs",   SqlDbType.VarChar,4000, DocIDStr),
                                       data.MakeInParam("@DeleteType",SqlDbType.Int,1,DeleteType)
                                   };
            try
            {
                data.RunProc("SP_DeleteDocument",prams);
                data = null;
                return true;
            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                return false;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }

            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:32,代碼來源:Document.cs

示例8: AddAttach

 /// <summary>
 /// �ļ��������ݿ����
 /// </summary>
 /// <param name="att">DocAttachFile��</param>
 /// <param name="DocID">�ļ�ID</param>
 public void AddAttach(DocAttachFile att,int DocID)
 {
     Database data = new Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@DocID",  SqlDbType.Int, 20, DocID),
                                data.MakeInParam("@FileName",  SqlDbType.VarChar, 300, att.FileName),
                                data.MakeInParam("@FileSize",  SqlDbType.Int, 20, att.FileSize),
                                data.MakeInParam("@FileAttribute",  SqlDbType.SmallInt,20, att.FileAttribute),
                                data.MakeInParam("@FileVisualPath",  SqlDbType.NVarChar, 200, att.FileVisualPath),
                                data.MakeInParam("@FileAuthor",  SqlDbType.NVarChar, 50, att.FileAuthor),
                                data.MakeInParam("@FileCatlog",  SqlDbType.NVarChar, 20, att.FileCatlog),
                                data.MakeInParam("@FileAddedDate", SqlDbType.DateTime, 30, DateTime.Parse(att.FileAddedDate))
                            };
     try
     {
         data.RunProc("SP_Ext_AddFile", prams);
     }
     catch (Exception ex)
     {
         Error.Log(ex.ToString());
         throw new Exception("�ļ��������ͳ���!",ex);
     }
     finally
     {
         if (data != null)
         {
             data.Close();
             data.Dispose();
         }
     }
 }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:36,代碼來源:Document.cs

示例9: GetAccessPermission

        /// <summary>
        /// 判斷用戶對對象是否有某個權限
        /// </summary>
        /// <param name="UserName">用戶名</param>
        /// <param name="classID">被檢查的對象</param>		
        /// <param name="actID">權限ID</param>
        /// <returns>是否有權限</returns>
        public bool GetAccessPermission(string UserName,int classID,int actID)
        {
            int flag = 0;
            // 定義數據庫操作類及DataReader
            Database data = new Database();

            // 執行存儲過程,並返回SqlDataReader對象
            SqlParameter[] prams = {
                                       data.MakeInParam("@Class_ID" , SqlDbType.Int, 20, classID),
                                       data.MakeInParam("@UserName" , SqlDbType.NVarChar, 20, UserName),
                                       data.MakeInParam("@Act_ID" , SqlDbType.Int, 20, actID),
                                       // data.MakeInParam("@Inheit" , SqlDbType.Bit, 1, 1),
                                       data.MakeOutParam("@ReturnValue",SqlDbType.Int,20)
                                   };

            try
            {
                data.RunProc("sp_GetAccessPermission",prams);
                flag = Int32.Parse(prams[3].Value.ToString());
                return (flag==1)?true:false;
            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("獲取訪問權出錯",ex);
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                    data = null;
                }
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:43,代碼來源:AssignRights.cs

示例10: GetTaskPeriod

        /// <summary>
        /// ���ij������ij��ĵ�ʱ��� ���س���Ϊ11��int�����飬��������ij��ԭ��û��ֵ����ֵΪ0
        /// </summary>
        public int[] GetTaskPeriod(string Date,string Username,int TaskID)
        {
            // �������ݿ�����༰DataReader
            Database data = new Database();
            SqlDataReader dataReader = null;
            int[] a = new int[20]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
            // ִ�д洢���̣�������SqlDataReader����
            SqlParameter[] prams = {
                                       data.MakeInParam("@Username",  SqlDbType.VarChar, 20, Username),
                                       data.MakeInParam("@Date",  SqlDbType.VarChar,30, Date),
                                       data.MakeInParam("@TaskID",  SqlDbType.Int,8, TaskID)
                                   };

            try
            {
                data.RunProc("sp_GetTaskPeriod",prams,out dataReader);

                while(dataReader.Read())
                {
                    a[Int32.Parse(dataReader[0].ToString())-1] = 7+Int32.Parse(dataReader[0].ToString());

                }

                    dataReader = null;
                    data.Dispose();
                return a;

            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("���ij������ij��ĵ�ʱ��γ���!",ex);
            }
            finally
            {

                if (data != null)
                {
                    data.Close();
                }
                if (dataReader != null)
                {
                    dataReader.Close();
                }
                dataReader = null;
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:50,代碼來源:Task.cs

示例11: DeleteTask

        /// <summary>
        /// ɾ��ij����
        /// </summary>
        public void DeleteTask(int TaskID)
        {
            // �������ݿ�����༰DataReader
            Database data = new Database();
            // ִ�д洢���̣�������SqlDataReader����
            SqlParameter[] prams = {
                                       data.MakeInParam("@TaskID",  SqlDbType.Int,8, TaskID)
                                   };

            try
            {
                data.RunProc("sp_DeleteTask",prams);
                data.Dispose();

            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("ɾ��ij����!",ex);
            }
            finally
            {

                if (data != null)
                {
                    data.Close();
                }
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:32,代碼來源:Task.cs

示例12: AdminBBS

        /// <summary>
        /// 判斷是否有管理權限
        /// </summary>
        /// <param name="username">用戶名</param>
        /// <returns>bool</returns>
        public bool AdminBBS(string username, int classid)
        {
            if (classid != 0)
            {
                int actid = 8;
                Database db = new Database();
                SqlParameter[] prams = {
                                           db.MakeInParam("@Class_ID",SqlDbType.Int,4,classid),
                                           db.MakeInParam("@Username",SqlDbType.VarChar,100,username),
                                           db.MakeInParam("@Act_ID",SqlDbType.Int,4,actid),
                                           db.MakeOutParam("@ReturnValue",SqlDbType.Int,4)
                                       };
                try
                {
                    db.RunProc("sp_GetAccessPermission", prams);
                    //					僅做測試用
                    //					return(true);
                    return ((Int32.Parse(prams[3].Value.ToString()) == 1) ? true : false);

                }
                catch (Exception ex)
                {
                    Error.Log(ex.Message);
                    throw new Exception("BBS權限判斷錯誤!", ex);
                }
                finally
                {
                    db.Close();
                    db.Dispose();
                }
            }
            else
                return (false);
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:39,代碼來源:BBS.cs

示例13: InsertFile

        public int InsertFile(string name, string extension)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@name",SqlDbType.VarChar,200,name),
                                       data.MakeInParam("@extension",SqlDbType.VarChar,100,extension)
                                   };
            try
            {

                return (data.RunProc("sp_BBS_AddFile", prams));
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:21,代碼來源:BBS.cs

示例14: EditBBSCatalog

        //更新分類欄信息
        public bool EditBBSCatalog(BBSCatalog BBSCatalog)
        {
            //	@catalog_id int,				:	分欄ID
            //	@catalog_name varchar(300),		:	分欄名稱
            //	@catalog_description varchar(300)	:	分欄介紹
            // 給存儲過程傳遞參數
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@catalog_id",  SqlDbType.Int, 4, BBSCatalog.CatalogID),
                                       data.MakeInParam("@catalog_name", SqlDbType.VarChar, 300, BBSCatalog.CatalogName),
                                       data.MakeInParam("@catalog_description", SqlDbType.VarChar ,300, BBSCatalog.CatalogDescription),
            };
            try
            {
                data.RunProc("sp_BBS_UpdateCatalogInfo", prams);
                return true;
            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("BBS類別編緝錯誤!", ex);

            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:33,代碼來源:BBS.cs

示例15: EditBBSBoard

        //更新板塊信息
        public bool EditBBSBoard(BBSBoard BBSBoard)
        {
            //@board_id int,				:	被更新的板塊ID
            //@board_name varchar(300)		:	板塊名稱
            //@board_description varchar(300),	:	板塊介紹
            //@board_type bit				:	板塊類型(公共型,私有型)
            // 給存儲過程傳遞參數
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@board_id",  SqlDbType.Int, 4, BBSBoard.BoardID),
                                       data.MakeInParam("@board_name", SqlDbType.VarChar, 300, BBSBoard.BoardName),
                                       data.MakeInParam("@board_description", SqlDbType.VarChar ,300, BBSBoard.BoardDescription),
                                       data.MakeInParam("@board_type", SqlDbType.Bit, 1 ,BBSBoard.BoardType),
            };
            //try
            {
                try
                {
                    data.RunProc("sp_BBS_UpdateBoardInfo", prams);
                }
                finally
                {
                    if (data != null)
                    {
                        data.Close();
                        data.Dispose();
                    }
                }
                return true;
            }
            //catch (Exception ex)
            {
                //	Error.Log(ex.ToString());
                //	throw new Exception("BBS板塊編緝錯誤!",ex);

            }
        }
開發者ID:blfsir,項目名稱:benzoa,代碼行數:38,代碼來源:BBS.cs


注:本文中的UDS.Components.Database.Dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。