zoukankan      html  css  js  c++  java
  • 随手记录修改某条记录时,不使用数据库控件而用datareader

    可能是很简单的,记录一下,以后自己好用

        protected void Page_Load(object sender, EventArgs e)
        
    {
            getSession.JuageSession();
    //自定义的一个检查登录状态的类
            if (!Page.IsPostBack)
            
    {
                
    int id =Convert.ToInt32(Request["id"]);
                
    this.ViewState["id"= id;
                
    string sqlexe = "select * from product where id = " + id;
                SQLDbDataReader dr 
    = userSql.db.ExecuteDataReader(sqlexe);
                
    if (dr.Read())
                
    {
                    
    this.title.Text = dr["title"].ToString();
                    
    this.content.Value = dr["content"].ToString();
                    DropBind(Convert.ToInt32(dr[
    "parent"]));
                    
    this.ViewState["smallimg"= dr["smallimg"];
                    
    this.ViewState["bigimg"= dr["bigimg"];
                    
    this.ViewState["id"= dr["id"];
                    
    this.audit.Checked = Convert.ToBoolean(dr["audit"]);
                    
    this.post.Text = dr["post"].ToString();
                    
    this.comment.Text = dr["comment"].ToString();
                }

                dr.Close();
                dr.Dispose();
                dr 
    = null;
                PageControlInt();

            }

        }
  • 相关阅读:
    Java命令行启动jar包更改默认端口以及配置文件的几种方式
    Windows下带配置文件的mysql命令行安装方法
    Windows下mysql主从搭建
    Windows下mysql集群搭建
    CAP原则(CAP定理)、BASE理论(精简)
    进程间通讯的7种方式
    Go Web 编程之 数据库
    Go 每日一库之 fsnotify
    Go 每日一库之 viper
    Go 每日一库之 go-ini
  • 原文地址:https://www.cnblogs.com/yeagen/p/1331190.html
Copyright © 2011-2022 走看看