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


C# DBHelper.Dispose方法代码示例

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


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

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            #region 标签信息
            string strTagInfo = "";

            try
            {
                string sql = "select * from [tb_tag] where tag_ispublic=1";
                DataTable dt = new DataTable();
                DBHelper dbh = new DBHelper(config.DBConn);
                dt = dbh.ExecuteDataTable("", sql);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        strTagInfo += "<a href=\"default.aspx?id=" + dt.Rows[i]["tag_id"].ToString() + "\" class=\"tag\" target=\"_blank\">" + dt.Rows[i]["tag_name"].ToString() + "</a>";
                    }
                }

                dbh.Dispose();
                dt.Dispose();
            }
            catch (Exception ex)
            {
                strTagInfo = ex.ToString();
            }

            this.tagBall.InnerHtml = strTagInfo;

            #endregion
        }
开发者ID:juxiaoqi,项目名称:LongmaoSite,代码行数:32,代码来源:tags.aspx.cs

示例2: PerformSystemCheck

 private void PerformSystemCheck()
 {
     DBHelper o = new DBHelper();
     o.Dispose();
 }
开发者ID:skgw,项目名称:GWHRA,代码行数:5,代码来源:SystemCheck.aspx.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            #region 标签信息
            string strTagInfo = "";
            string strTagID = "0";
            strTagID = TagID;

            strTagInfo += "<ul class=\"nav nav-tabs nav-stacked\">";

            if (Class_UserLogin.IsLogin())
            {
                if (strTagID == "0" || strTagID == null)
                {
                    strTagInfo += "<li class=\"active\"><a href=\"myfav.aspx\">我的收藏</a></li>";
                }
                else
                {
                    strTagInfo += "<li><a href=\"myfav.aspx\">我的收藏</a></li>";
                }
            }
            else
            {
                if (strTagID == "0" || strTagID == null)
                {
                    strTagID = "8";
                }
            }

            try
            {
                string sql = "select top 10 * from [tb_tag] where tag_ispublic=1 order by tag_order desc";
                DataTable dt = new DataTable();
                DBHelper dbh = new DBHelper(config.DBConn);
                dt = dbh.ExecuteDataTable("", sql);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["tag_id"].ToString() == strTagID)
                        {
                            strTagInfo += "<li class=\"active\"><a href=\"default.aspx?id=" + dt.Rows[i]["tag_id"].ToString() + "\">" + dt.Rows[i]["tag_name"].ToString() + "</a></li>";
                        }
                        else
                        {
                            strTagInfo += "<li><a href=\"default.aspx?id=" + dt.Rows[i]["tag_id"].ToString() + "\">" + dt.Rows[i]["tag_name"].ToString() + "</a></li>";
                        }

                    }
                }

                dbh.Dispose();
                dt.Dispose();
            }
            catch (Exception ex)
            {
                strTagInfo = ex.ToString();
            }

            strTagInfo += "<li><a href=\"tags.aspx\">全部标签</a></li>";

            strTagInfo += "</ul>";
            #endregion

            #region 站点信息

            string strSiteInfo = "";
            try
            {
                string sql = "select * from [tb_site]";

                if (Class_UserLogin.IsLogin())
                {
                    if (strTagID == "0" || strTagID == null)
                    {
                        sql = "select a.*,b.* from [tb_site] a,[tb_site_user] b where a.site_id=b.su_siteid and b.su_userid='" + Class_UserLogin.UserID().ToString() + "'";
                    }
                    else
                    {
                        sql = "select e.* from (select a.*,d.su_id  from [tb_site] a left join  [tb_site_user] d on d.su_userid='" + Class_UserLogin.UserID().ToString() + "' and a.site_id=d.su_siteid) as e,[tb_site_tag] b,[tb_tag] c where e.site_id=b.st_siteid and c.tag_id=b.st_tagid and e.site_ispublic=1 and c.tag_ispublic=1 and c.tag_id='" + strTagID + "' order by e.su_id desc,e.site_id asc";
                    }
                }
                else
                {
                    sql = "select a.* from [tb_site] a,[tb_site_tag] b,[tb_tag] c where a.site_id=b.st_siteid and c.tag_id=b.st_tagid and a.site_ispublic=1 and c.tag_ispublic=1 and c.tag_id='" + strTagID + "' order by a.site_id asc";
                }

                DataTable dt = new DataTable();
                DBHelper dbh = new DBHelper(config.DBConn);
                dt = dbh.ExecuteDataTable("", sql);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        strSiteInfo += "<div class=\"topic_hot_list span5\"><a target=\"_blank\" href=\"" + dt.Rows[i]["site_url"].ToString() + "\" class=\"icon pull-left\"><img src=\"" + dt.Rows[i]["site_img"].ToString() + "\"></a><a target=\"_blank\" class=\"title\" href=\"" + dt.Rows[i]["site_url"].ToString() + "\">" + dt.Rows[i]["site_name"].ToString() + "</a>";
                        if (Class_UserLogin.IsLogin())
                        {
                            if (dt.Rows[i]["su_id"].ToString() == null || dt.Rows[i]["su_id"].ToString() == "")
                            {
//.........这里部分代码省略.........
开发者ID:juxiaoqi,项目名称:LongmaoSite,代码行数:101,代码来源:default.aspx.cs

示例4: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Class_UserLogin.IsLogin())
            {
                Response.Redirect("login.aspx?url=myadd.aspx");
            }

            if (strPost == "yes")
            {
                try
                {
                    string sql = "declare @newid as int;insert into tb_site(site_name,site_url,site_img,site_isopen,site_ispublic,site_createtime)values('" + SiteName + "','" + SiteURL + "','',1,0,'" + DateTime.Now.ToString() + "');set @[email protected]@IDENTITY;insert into tb_site_user(su_siteid,su_userid,su_createtime)values(@newid," + Class_UserLogin.UserID() + ",'" + DateTime.Now.ToString() + "');SELECT @@IDENTITY;";
                    DataTable dt = new DataTable();
                    DBHelper dbh = new DBHelper(config.DBConn);
                    dt = dbh.ExecuteDataTable("", sql);
                    dbh.Dispose();
                    dt.Dispose();
                    this.addinfo.InnerHtml = "提交成功!";
                    this.addinfo.Style.Remove("display");
                }
                catch { }
            }
        }
开发者ID:juxiaoqi,项目名称:LongmaoSite,代码行数:23,代码来源:myadd.aspx.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            #region 判断用户是否登录
            if (!Class_UserLogin.IsLogin())
            {
                Response.Redirect("login.aspx?url=myfav.aspx");
            }
            #endregion

            #region 站点信息

            string strSiteInfo = "";
            try
            {
                string sql = "select a.* from [tb_site] a,[tb_site_user] b where a.site_id=b.su_siteid and b.su_userid='" + Class_UserLogin.UserID().ToString() + "'";

                DataTable dt = new DataTable();
                DBHelper dbh = new DBHelper(config.DBConn);
                dt = dbh.ExecuteDataTable("", sql);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        strSiteInfo += "<div class=\"topic_hot_list span5\"><a target=\"_blank\" href=\"" + dt.Rows[i]["site_url"].ToString() + "\" class=\"icon pull-left\"><img src=\"" + dt.Rows[i]["site_img"].ToString() + "\"></a><a target=\"_blank\" class=\"title\" href=\"" + dt.Rows[i]["site_url"].ToString() + "\">" + dt.Rows[i]["site_name"].ToString() + "</a>";

                        if (dt.Rows[i]["site_ispublic"].ToString() == "0")
                        {
                            strSiteInfo += "<a href=\"javascript:config_control('" + dt.Rows[i]["site_id"].ToString() + "');\" data-id=\"" + dt.Rows[i]["site_id"].ToString() + "\" class=\"config\"></a>";
                        }

                        strSiteInfo += "<a href=\"javascript:fav_control('" + dt.Rows[i]["site_id"].ToString() + "');\" data-id=\"" + dt.Rows[i]["site_id"].ToString() + "\" class=\"followed follow\"></a>";

                        strSiteInfo += "</div>";
                    }
                }
                else
                {
                }

                dbh.Dispose();
                dt.Dispose();
            }
            catch (Exception ex)
            {
                strSiteInfo = ex.ToString();
            }

            this.myfavsite.InnerHtml = strSiteInfo;
            #endregion

            #region 标签信息
            string strTagInfo = "";

            try
            {
                string sql = "select * from [tb_tag] where tag_ispublic=1";
                DataTable dt = new DataTable();
                DBHelper dbh = new DBHelper(config.DBConn);
                dt = dbh.ExecuteDataTable("", sql);

                if (dt.Rows.Count > 0)
                {
                    strTagInfo += "<ul>";
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        strTagInfo += "<li style=\"float:left;margin-right:15px;\"><input id=\"tag" + dt.Rows[i]["tag_id"].ToString() + "\" name=\"tagcheck\" value=\"" + dt.Rows[i]["tag_id"].ToString() + "\" class=\"input-medium\" type=\"checkbox\"> <label for=\"tag" + dt.Rows[i]["tag_id"].ToString() + "\">" + dt.Rows[i]["tag_name"].ToString() + "</label><li>";
                    }
                    strTagInfo += "</ul>";
                }

                dbh.Dispose();
                dt.Dispose();
            }
            catch (Exception ex)
            {
                strTagInfo = ex.ToString();
            }

            this.sitetags.InnerHtml = strTagInfo;

            #endregion
        }
开发者ID:juxiaoqi,项目名称:LongmaoSite,代码行数:83,代码来源:myfav.aspx.cs


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