本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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;
}
}
}
示例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;
}
}
示例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();
}
}
}
示例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);
}
示例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();
}
}
}
示例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();
}
}
}
示例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);
}
}