• 更新 增加 用Table形式


    private void Add_Click(object sender, System.EventArgs e)
            
    {
                DataTable dt 
    = CommonBLL.GetSchema(Utility.Utility.TableName.RepairRecord).Tables[0];
                dt.TableName
    =Utility.Utility.TableName.RepairRecord;
                DataRow dr;
                dr
    =dt.NewRow();

                dr[
    "RepairBaseId"]=Request["id"].ToString();    
                dr[
    "Content"]=this.Content.Text;
                dr[
    "Repairdate"]=Request.Form["startdate"].ToString();
                dr[
    "Repaircost"]=this.repaircost.Text;
                dr[
    "UserID"]=Request["userid"].ToString();    
                dr[
    "Name"]=this.name.Text;
                dr[
    "Phone"]=this.phone.Text;
                dr[
    "RegTime"]=System.DateTime.Now;
                dt.Rows.Add(dr);
                CommonBLL.Insert(dt,
    "ID");
                
    string script="<script language=javascript>alert('增加成功');window.location.href='RepairRecordList.aspx';</script>";
                
    this.Page.RegisterClientScriptBlock("",script);
            }
    private void Update_Click(object sender, System.EventArgs e)
            
    {
                DataTable dt
    =Repair.RepairModel.GetRepairRecordById(Convert.ToInt32(Request["RepairRecordId"]));
                dt.TableName
    =Utility.Utility.TableName.RepairRecord;
                DataRow dr;
                dr
    =dt.Rows[0];

                
                dr[
    "RepairBaseId"]=Request["RepairBaseId"].ToString();    
                dr[
    "Content"]=this.Content.Text;
                dr[
    "Repairdate"]=Request.Form["startdate"].ToString();
                dr[
    "Repaircost"]=this.repaircost.Text;
                
    //dr["UserID"]=Request["userid"].ToString();    
                dr["Name"]=this.name.Text;
                dr[
    "Phone"]=this.phone.Text;
            
    //    dr["RegTime"]=System.DateTime.Now;
                Repair.RepairModel.UpdateRepairBase(dr,dt.TableName,"ID");
                
                
    string script="<script lanaguage='javascript'>alert('更新成功');window.location.href='RepairRecordDetail.aspx?RepairRecordId="+Convert.ToInt32(Request["RepairRecordId"])+"&userid="+Convert.ToInt32(Request["userid"])+"';</script>";
                Page.RegisterStartupScript(
    "",script);
            }
  • 相关阅读:
    python web 2
    python web1(解析url)
    webstrom 今天突然要激活
    数组排序 记录一下
    浏览器添加随机数去除缓存
    vue-cli 安装报错
    vue 初始化项目报错
    深拷贝和浅拷贝
    css3 属性 clip-path
    js数组去重
  • 原文地址:https://www.cnblogs.com/sujingnan/p/1119591.html
Copyright © 2020-2023  润新知