本文整理汇总了C#中UDS.Components.Database.Close方法的典型用法代码示例。如果您正苦于以下问题:C# Database.Close方法的具体用法?C# Database.Close怎么用?C# Database.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UDS.Components.Database
的用法示例。
在下文中一共展示了Database.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bangding
private void Bangding()
{
SqlDataReader dr = null; //存放人物的数据
Database mySQL = new Database();
try
{
SqlParameter[] parameters = {
mySQL.MakeInParam("@NewsID",SqlDbType.Int ,4,0)
};
mySQL.RunProc("sp_Flow_GetNews", parameters, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dgStyleListAdmin.DataSource = dt.DefaultView;
dgStyleListAdmin.DataBind();
}
finally
{
if (mySQL != null)
{
mySQL.Close();
}
if (dr != null)
{
dr.Close();
}
}
}
示例2: BindGrid
private void BindGrid()
{
SqlDataReader dr=null; //������������
Database db = new Database();
try
{
SqlParameter[] prams = {
db.MakeInParam("@RoleID",SqlDbType.Int,4,RoleID)
};
if (DisplayType == 0)
db.RunProc("sp_GetStaffInRole", prams, out dr);
else
db.RunProc("sp_GetStaffNotInRole", prams, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dbStaffList.DataSource = dt.DefaultView;
dbStaffList.DataBind();
}
finally
{
if (db != null)
{ db.Close(); }
if (dr != null)
{
dr.Close();
}
}
}
示例3: BindGrid
private void BindGrid()
{
SqlDataReader dr=null; //������������
Database db = new Database();
try
{
SqlParameter[] prams = {
db.MakeInParam("@StaffType",SqlDbType.Bit,1,DisplayType)
};
db.RunProc("sp_GetStaffisneedkey", prams, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dbStaffList.DataSource = dt.DefaultView;
dbStaffList.DataBind();
}
finally
{
if (db != null)
{
db.Close();
}
if (dr != null)
{
dr.Close();
}
}
}
示例4: 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();
}
}
}
示例5: 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();
}
}
}
示例6: Bangding
private void Bangding()
{
SqlDataReader dr=null; //������������
Database mySQL = new Database();
try
{
String UserName;
UserName = Server.UrlDecode(Request.Cookies["UserName"].Value);
SqlParameter[] parameters = {
mySQL.MakeInParam("@UserName",SqlDbType.VarChar,255,UserName)
};
mySQL.RunProc("sp_GetSubscripitionClass", parameters, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
//��DataTable��ĩβ���Ͽ��У�ʹ��DataGrid�̶�����
// int iBlankRows = dgMySubsciption.PageSize - (dt.Rows.Count % dgMySubsciption.PageSize);
//
// for (int i = 0; i < iBlankRows; i++)
// {
// dt.Rows.Add(dt.NewRow()) ;
// }
dgMySubsciption.DataSource = dt.DefaultView;
dgMySubsciption.DataBind();
//���ڿռ�¼����ʾcheckbox
//
// if(dgMySubsciption.CurrentPageIndex == dgMySubsciption.PageCount -1 )
// {
// for(int i= (dgMySubsciption.PageSize - iBlankRows) ;i<dgMySubsciption.Items.Count;i++)
// {
// dgMySubsciption.Items[i].FindControl("ClassID").Visible = false;
// }
// }
}
finally
{
if (mySQL != null)
{
mySQL.Close();
}
if (dr != null)
{
dr.Close();
}
}
btnDeleteSubscription.Attributes ["onclick"]="javascript:return confirm('��ȷ��Ҫɾ���˶�����?');";
}
示例7: Bangding
private void Bangding()
{
SqlDataReader dr;
Database db = new Database();
SqlParameter[] parms = {
db.MakeInParam("@NewsID",SqlDbType.Int ,4,BoardID),
};
db.RunProc("sp_Flow_GetNews", parms, out dr);
try
{
if (dr.Read())
{
// txtBoardName.Text = dr["Board_Name"].ToString();
this.board_content.InnerHtml = dr["News_Content"].ToString();
}
if (db != null)
{
db.Close();
db = null;
}
}
finally
{
if (db != null)
{
db.Close();
}
if (dr != null)
{
dr.Close();
}
dr = null;
}
}
示例8: BindGrid
public void BindGrid()
{
SqlDataReader dr=null; //���Ȩ������
string spName;//�洢������
spName = "";
Database db = new Database();
SqlParameter[] prams = new SqlParameter[1];
try
{
switch (DisplayType)
{
case "0":
prams[0] = db.MakeInParam("@PositionID", SqlDbType.Int, 4, Int32.Parse(strObjID));
spName = "sp_GetPositionRightList";
break;
case "1":
prams[0] = db.MakeInParam("@Teamid", SqlDbType.Int, 4, Int32.Parse(strObjID));
spName = "sp_GetTeamRightList";
break;
case "2":
prams[0] = db.MakeInParam("@RoleID", SqlDbType.Int, 4, Int32.Parse(strObjID));
spName = "sp_GetRoleRightList";
break;
default:
break;
//������
}
db.RunProc(spName, prams, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
RightsGrid.DataSource = dt.DefaultView;
RightsGrid.DataBind();
}
finally
{
if (db != null)
{ db.Close(); }
if (dr != null)
{
dr.Close();
}
}
}
示例9: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
// �ڴ˴������û������Գ�ʼ��ҳ��
SqlDataReader dr_sellman = null;
Database db = new Database();
try
{
db.RunProc("sp_GetAllStaff", out dr_sellman);
lbx_Staff.DataSource = dr_sellman;
lbx_Staff.DataTextField = "staff_name";
lbx_Staff.DataValueField = "staff_id";
lbx_Staff.DataBind();
}
finally
{
db.Close();
dr_sellman.Close();
}
}
示例10: Bingding
private void Bingding()
{
SqlDataReader dr;
Database mySQL = new Database();
SqlParameter[] p2 = {
mySQL.MakeInParam("@StaffName",SqlDbType.VarChar,300,UserName)
};
mySQL.RunProc("sp_Flow_GetParentProject",p2,out dr);
lbProject.Items.Clear();
while(dr.Read())
{
lbProject.Items.Add(new ListItem(dr["ClassName"].ToString(),dr["ClassID"].ToString()));
}
dr.Close();
mySQL.Close();
}
示例11: 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();
}
}
}
示例12: 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;
}
示例13: 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;
}
}
示例14: BindPosition
private void BindPosition()
{
Database db = new Database();
SqlDataReader dr=null;
try
{
db.RunProc("SP_Ext_GetPosition", out dr);
ddl_Position.DataSource = dr;
ddl_Position.DataTextField = "Position_Name";
ddl_Position.DataValueField = "Position_ID";
ddl_Position.DataBind();
ddl_Position.Items.Insert(0, new ListItem("ȫ��", "0"));
}
finally
{
if (db != null)
{ db.Close(); }
if (dr != null)
{
dr.Close();
}
}
}
示例15: InitDataGrid
private void InitDataGrid()
{
SqlDataReader dr; //������������
Database mySQL = new Database();
SqlParameter[] parameters = {
mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,StepID),
mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,0)
};
mySQL.RunProc("sp_Flow_GetJump",parameters,out dr);
try
{
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dr.Close();
dr = null;
dgJumpList.DataSource = dt.DefaultView;
dgJumpList.DataBind();
}
finally
{
if (mySQL != null)
{
mySQL.Close();
}
if (dr != null)
{
dr.Close();
}
}
}