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


C# DB.Update方法代码示例

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


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

示例1: Add_Update

        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("groups");

                DataBase.AddColumn("grp_name", Type_TB.Text);

                if(Group_Id == null)
                {
                    if(DataBase.IsNotExist("grp_id", "grp_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذا النوع من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("grp_id", this.Group_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:Groups.xaml.cs

示例2: Add_Update

        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("Categories");

                DataBase.AddColumn("cat_name", Category_TB.Text.Trim());

                if(Category_Id == null)
                {
                    if(DataBase.IsNotExist("cat_id", "cat_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل هذه الفئة من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("cat_id", this.Category_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:Categories.xaml.cs

示例3: Add_Update

        private bool Add_Update()
        {
            try
            {
                DB db = new DB("products");

                db.AddColumn("pro_cat_id", Categories_CB.SelectedValue);
                db.AddColumn("pro_name", Product_TB.Text.Trim());
                db.AddColumn("pro_sell", Sell_Price_TB.Text.Trim());


                if(Product_Id == null)
                {
                    if(db.IsNotExist("pro_id", "pro_name", "pro_cat_id"))
                    {
                        return db.Insert();
                    }
                    else
                    {
                        Message.Show("هذا المنتج مسجل من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }
                }
                else
                {                 
                    db.AddCondition("pro_Id", this.Product_Id);
                    return db.Update();
                }

            }
            catch
            {
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:Product.xaml.cs

示例4: change_Click

    protected void change_Click(object sender, EventArgs e)
    {
        DB db = new DB();
        DataSet ds = db.Select("select * from admin where admin_ID='" + Session["username"] + "'", db.DBconn());
        try
        {     string password = ds.Tables[0].Rows[0][2].ToString();
            md5Manger md5 = new md5Manger();
             password = md5.Md5Decrypt(password);
            //解密
       
            string oldpassword = this.oldpassword.Text.Trim();
            string newpassword = this.newpassword.Text.Trim();
            if (password.Equals(oldpassword))
            {
                newpassword = md5.Md5Encrypt(newpassword);//加密
                string updatepassword = "UPDATE admin SET password ='" + newpassword + "' WHERE admin_ID ='" + Session["username"].ToString() + "'";
                bool result = db.Update(updatepassword, db.DBconn());
                // Response.Write("<script language='javascript'>alert('您的jieguo为:" + result + "')</script>");
                if (result)
                {


                    this.message.Text = "密码更改成功!";

                }

                else
                {
                    this.message.Text = "数据库更新失败!";

                }

            }

            else
            {
                this.message.Text = "对不起,您的密码输入错误,请重新输入";

            }
        
        }
        catch
        {
            Response.Write("<script>alert('数据库获取用户密码错误。');location='Default.aspx'</script>");
        }
       finally
       {
           ds.Clear();
       }
    }
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:50,代码来源:passwordModify.aspx.cs

示例5: Add_Update

        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("attendence");

                DataBase.AddColumn("att_emp_id", Employees_CB.SelectedValue);
                DataBase.AddColumn("att_date", Date_DTP.Value.Value.Date);
                DataBase.AddColumn("att_attend", Attend_DTP.Value.Value.TimeOfDay);
                DataBase.AddColumn("att_leave", null);
                DataBase.AddColumn("att_time", null);
                if(Leave_DTP.Value != null)
                {
                    DataBase.Columns_Values[3].Value = Leave_DTP.Value.Value.TimeOfDay;
                    DataBase.Columns_Values[4].Value = Attend_DTP.Value.Value.TimeOfDay <= Leave_DTP.Value.Value.TimeOfDay ?
                                                       Leave_DTP.Value.Value.TimeOfDay - Attend_DTP.Value.Value.TimeOfDay :
                                                       Leave_DTP.Value.Value.TimeOfDay.Add(new TimeSpan(24, 0, 0)) - Attend_DTP.Value.Value.TimeOfDay;
                }
                if(Attendence_Id == null)
                {
                    if(DataBase.IsNotExist("att_id", "att_emp_id", "att_date"))
                    {
                        return DataBase.Insert();
                    }
                    else
                    {
                        Message.Show("هذا الاسم مستخدم من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }
                }
                else
                {
                    DataBase.AddCondition("att_Id", this.Attendence_Id);
                    return DataBase.Update();
                }

            }
            catch
            {
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:43,代码来源:Add_Update_Attendence.xaml.cs

示例6: Add_Update

        public bool Add_Update()
        {
            try
            {
                DB DataBase = new DB("users");
                if(Password_TB.Text.Equals(RePassword_TB.Text))
                {
                    if(this.User_Id == null)
                    {
                        DataBase.AddColumn("user_name", Name_TB.Text);
                        DataBase.AddColumn("user_pass", Password_TB.Text.Trim().GetHashCode());
                        DataBase.AddColumn("user_grp_id", Groups_CB.SelectedValue);

                        if(DataBase.IsNotExist("user_id", "user_name"))
                        {
                            return DataBase.Insert();
                        }
                        else
                        {
                            Message.Show("هذا الاسم مستخدم من قبل", MessageBoxButton.OK, 5);
                            return false;
                        }
                    }
                    else
                    {
                        switch(Edit_Mode)
                        {
                            case Edit_Mode.Edit:
                                DataBase.AddColumn("user_name", Name_TB.Text);
                                DataBase.AddColumn("user_grp_id", Groups_CB.SelectedValue);
                                break;
                            case Edit_Mode.Change_Password:
                                DataBase.AddColumn("user_pass", Password_TB.Text.Trim().GetHashCode());
                                break;
                        }
                        DataBase.AddCondition("user_id", this.User_Id);
                        return DataBase.Update();
                    }
                }
                else
                {
                    Message.Show("كلمة المرور غير متطابقة", MessageBoxButton.OK, 10);
                    return false;
                }
            }
            catch
            {
                return false;
            }

        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:51,代码来源:User.xaml.cs

示例7: Add_Update

        public bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("outcome");

                DataBase.AddColumn("out_date", Date_TB.Text);
                DataBase.AddColumn("out_value", Value_TB.Text);
                DataBase.AddColumn("out_description", Description_TB.Text);
                DataBase.AddColumn("out_ott_id", Type_CB.SelectedValue);
                //DataBase.AddColumn("out_pon_id", Point_ID);



                if (this.Outcome_Id == null)
                {
                    if (DataBase.IsNotExist("out_id", "out_date", "out_value", "out_description", "out_ott_id", "out_pon_id"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        // ye3ny hwa mawgood asln mesh ha3ml 7aga 
                        Message.Show("هذا المستند موجود من قبل", MessageBoxButton.OK, 5);
                        return false;
                        //DataBase.AddCondition("pl_id", this.placeId);
                        //DataBase.Update();

                    }


                }

// hena ye3ny hwa mawgod ba3mel edit
                else
                {
                    DataBase.AddCondition("out_id", this.Outcome_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                return Confirm.Check(false);
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:46,代码来源:Outcome.xaml.cs

示例8: Add_Update

        public bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("outcome_types");

                DataBase.AddColumn("ott_name", Name_TB.Text);

                if (this.TypeId == null)
                {
                    if (DataBase.IsNotExist("ott_id", "ott_name"))
                    {
                        return Confirm.Check(DataBase.Insert());
                    }
                    else
                    {
                        Message.Show("لقد تم تسجيل نوع المصروف من قبل", MessageBoxButton.OK, 5);
                        return false;
                    }


                }
                else
                {
                    DataBase.AddCondition("ott_id", this.TypeId);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:35,代码来源:OutCome_Types.xaml.cs

示例9: Button1_Click

    protected void Button1_Click(object sender, EventArgs e)
    {
        DB db = new DB();
        //String time = period_star.Year + "年" + period_star.Month + "月" + period_star.Day + "日";
        //赋值
        if (Button1.Text == "提交")//插入操作
        {
            if (this.TextBox1.Text == "")
            {
                Response.Write("<script>alert('论文小结不能为空!');</script>");
                return;
            }
            //查找是否存在于表中如果存在则相当已修改,不存在为插入
            String insert = "insert into aimCom(student_ID,student_Name,Depart,class,teacher_Name,time,title,AimComplete,Year,teacher_ID) values('" +

Label1.Text + "','" + Label2.Text + "','" + Label3.Text + "','" + Label4.Text + "','" + Label5.Text + "','" +

Label6.Text + "','" + Label7.Text + "','" + this.TextBox1.Text + "','" + Session["year"] + "','" + Session["teacher_ID"] + "') ";
           
            if (db.Insert(insert, db.DBconn()))
            {
                Response.Write("<script>alert('毕业论文小结填写成功。');location='summarization.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('毕业论文小结填写失败。');location='summarization.aspx'</script>");
            }

        }
        else//更新操作
        {
            String update = "update aimCom set AimComplete='" + this.TextBox1.Text + "' where student_ID='" + Session["username"] + "'";

            if (db.Update(update, db.DBconn()))
            {
                Response.Write("<script>alert('毕业论文小结修改成功。');location='summarization.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('毕业论文小结修改失败。');location='summarization.aspx'</script>");
            }

        }

    }
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:45,代码来源:summarization.aspx.cs

示例10: Add_Update

        private bool Add_Update()
        {
            try
            {

                DB DataBase = new DB("Properties");

                DataBase.AddColumn("prp_name", Property_TB.Text.Trim());
                DataBase.AddColumn("prp_cat_id", Categories_CB.SelectedValue, Categories_CB.SelectedIndex < 1);

                if(Property_Id == null)
                {
                    if(Categories_CB.SelectedIndex < 1)
                    {
                        if(DataBase.IsNotExist("prp_id", "prp_name"))
                        {
                            return Confirm.Check(DataBase.Insert());
                        }
                        else
                        {
                            Message.Show("لقد تم تسجيل هذه الصفة من قبل", MessageBoxButton.OK, 5);
                            return false;
                        }
                    }
                    else
                    {
                        if(DataBase.IsNotExist("prp_id", "prp_name", "prp_cat_id"))
                        {
                            return Confirm.Check(DataBase.Insert());
                        }
                        else
                        {
                            Message.Show("لقد تم تسجيل هذه الصفة من قبل", MessageBoxButton.OK, 5);
                            return false;
                        }
                    }



                }
                else
                {
                    DataBase.AddCondition("prp_id", this.Property_Id);
                    return Confirm.Check(DataBase.Update());
                }
            }
            catch
            {
                //MessageBox.Show("kiki_method");
                return false;
            }
        }
开发者ID:Enumeg,项目名称:POS-General,代码行数:52,代码来源:Properties.xaml.cs

示例11: select

    public void select(int PRI, int Select){
         DB db = new DB(); 
   
        //获取学生信息
        string student_ID = Session["username"].ToString();
        string name =  Session["name"].ToString();
        String sel = "select * from student where student_ID='" +student_ID+"'";
        DataSet ds = db.Select(sel,db.DBconn());
         String class1="";
         String grade = "";
        try
        {
         class1 = ds.Tables[0].Rows[0][13].ToString();
         grade = ds.Tables[0].Rows[0][15].ToString();
         ds.Clear();
        }
        catch
        {
            Response.Write("<script>alert('数据库出错,获取学生信息错误。');location='studentSelect.aspx'</script>");
        }

        //获取论文信息
      
        string teacher_ID=Request.QueryString["teacher_ID"];
          sel = "select * from paperApply where id='" +Session["paperid"]+ "'";
           ds = db.Select(sel, db.DBconn());
          String title = "";
          String teacher_Name = "";
          String direction = "";
          String introduce = "";
          String paperid = "";
          try
          {

               title =ds.Tables[0].Rows[0][3].ToString();
               teacher_Name = Convert.ToString(ds.Tables[0].Rows[0][20].ToString());
               direction = ds.Tables[0].Rows[0][4].ToString();
               introduce =ds.Tables[0].Rows[0][13].ToString();
               paperid=ds.Tables[0].Rows[0][0].ToString();
              ds.Clear();

          }
          catch
          {
              Response.Write("<script>alert('数据库出错,获取教师信息错误。');location='studentSelect.aspx'</script>");
          }

        int priority = PRI;
        Response.Write("<script>if(confirm('这将是您的第" + priority + "志愿,是否选定?选定后如需修改只能通过删除重选。')){ } else{location='Default.aspx'}</script>");
        string insert1 = "insert into themeSelectedResult(student_ID,name,class,teacher_ID,teacher_name,title,direction,introduce,priority,grade,paperid)  values('" + student_ID + "','" + name + "','" + class1 + "','" + teacher_ID + "','" + teacher_Name + "','" + title + "','" + direction + "','" + introduce + "','" + priority + "','" + grade + "','" + paperid + "')";//导入数据
        Select++;
        string update = "";
        if (priority == 1)
        {
             update = "update paperApply set first_select='" + Select + "' where id='" + paperid + "'";//更新选题情况信息
        }
        if (priority == 2)
        {
             update = "update paperApply set second_select='" + Select + "' where id='" + paperid + "'";//更新选题情况信息
        }
        if (priority == 3)
        {
            update = "update paperApply set third_select='" + Select + "' where id='" + paperid + "'";//更新选题情况信息
        }

        if (db.Insert(insert1, db.DBconn()) && db.Update(update, db.DBconn()))
        {
            Response.Write("<script>alert('您的课题第" + priority + "志愿选择成功');location='studentSelect.aspx'</script>");
        }

        else
        {
            Response.Write("<script>alert('您的课题第" + priority + "志愿选择失败');location='studentSelect.aspx'</script>");
        }
    }
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:75,代码来源:studentSelect1.aspx.cs

示例12: Page_Load


//.........这里部分代码省略.........

        //获取数据
  
            Session["paperid"] = Request.QueryString["paperid"].ToString();
            string paperid = Request.QueryString["paperid"].ToString();
            string tag = "";
            string priority = "";
            try
            {
                tag = Request.QueryString["tag"].ToString();
                priority = Request.QueryString["priority"].ToString();
            }
            catch
            {
            }
      
 //查题*************************************** 
        String sel = "select * from paperApply where id='" + Request.QueryString["paperid"].ToString() + "'";
         ds = db.Select(sel, db.DBconn());
            try
            {  
               
            
                this.Label1.Text = ds.Tables[0].Rows[0][3].ToString();
                Label3.Text = ds.Tables[0].Rows[0][2].ToString();
                Label4.Text = ds.Tables[0].Rows[0][4].ToString();
                Label5.Text = ds.Tables[0].Rows[0][5].ToString();
                Label6.Text = ds.Tables[0].Rows[0][6].ToString();
                Label7.Text = ds.Tables[0].Rows[0][7].ToString();
                String teacher_Name = Convert.ToString(ds.Tables[0].Rows[0][20].ToString());
                Label8.Text = " 教工号:" + Request.QueryString["teacher_ID"] + " 教师姓名:" + teacher_Name;
                this.TextBox1.Text = ds.Tables[0].Rows[0][8].ToString(); ;
                this.TextBox2.Text = ds.Tables[0].Rows[0][9].ToString(); ;
                this.TextBox3.Text = ds.Tables[0].Rows[0][10].ToString();
                this.TextBox4.Text = ds.Tables[0].Rows[0][11].ToString();
                this.TextBox5.Text = ds.Tables[0].Rows[0][12].ToString();
                this.TextBox6.Text = ds.Tables[0].Rows[0][13].ToString();
                int first_select = Convert.ToInt32(ds.Tables[0].Rows[0][17].ToString());
                int second_select = Convert.ToInt32(ds.Tables[0].Rows[0][18].ToString());
                int third_select = Convert.ToInt32(ds.Tables[0].Rows[0][19].ToString());
                this.Label2.Text = "该课题选择情况:第一志愿" + first_select + "人,第二志愿" + second_select + "人,第三志愿" + third_select + "人。";    
                if (tag.Equals("1"))//删除操作
                {
                    string update = "";//初始化更新语句
                    if (priority.Equals("1"))//第一志愿
                    {
                        first_select = Convert.ToInt32(ds.Tables[0].Rows[0][17].ToString());
                        first_select--;
                        update = "update paperApply set first_select='" + first_select + "' where id='" + paperid + "'";//更新选题情况信息
                       
                    }
                    if (priority.Equals("2"))//第二志愿
                    {
                         second_select = Convert.ToInt32(ds.Tables[0].Rows[0][18].ToString());
                        second_select--;
                         update = "update paperApply set second_select='" + second_select + "' where id='" + paperid + "'";//更新选题情况信息
                    }
                    if (priority.Equals("3"))//第三志愿
                    {
                        third_select = Convert.ToInt32(ds.Tables[0].Rows[0][19].ToString());
                        third_select--;
                        update = "update paperApply set first_select='" + third_select + "' where id='" + paperid + "'";//更新选题情况信息
                    }
                     string del="delete from themeSelectedResult where student_ID='"+Session["username"]+"'and priority='"+priority+"'";

                     if (db.Update(update, db.DBconn()) && db.Delete(del, db.DBconn()))
                        
                    {
                            Response.Write("<script>alert('您的课题第" + priority + "志愿删除成功');location='studentSelect.aspx'</script>");
                       
                    }
  
                    else  
                    {
                        Response.Write("<script>alert('您的课题第" + priority + "志愿删除失败');location='studentSelect.aspx'</script>");   
                    }     

                }
               
              
            }
            catch
            {
                Response.Write("<script>alert('数据库出错。');location='studentSelect.aspx'</script>");
            }
            finally
            {
                ds.Clear();
            }

         //判断选题次数\
        String  sel1="select * from themeSelectedResult where student_ID='"+Session["username"]+"'";
        ds = db.Select(sel1, db.DBconn());

        if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 3)
        {
                Button3.Enabled = false;
                Response.Write("<script>alert('你已经选择三个志愿了,不可以再提交。');location='studentSelect.aspx'</script>");
        }  
    }
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:101,代码来源:studentSelect1.aspx.cs

示例13: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Write("<script>alert('用户登录超时,请重新登录。');location='../Default.aspx'</script>");
            return;
        
        }
        
        if (!Page.IsPostBack)
        {
            this.GridView1.Visible = true;
            this.GridView2.Visible = false;
        }
        DB db = new DB();
       
        string role = Session["role"].ToString();
        if (role == "院领导")//权限判定
        {
        }
        else
        {
            Response.Write("<script language='javascript'>alert('你的角色为" + role + ",不可以进入院领导审核页面!');location='Default.aspx'</script>");
        }
        //chushi进入页面需要更新或加载数据
        string sel = "select * from student where  grade='"+Session["year1"].ToString()+"'";//依次查询本届学生信息
        DataSet ds = db.Select(sel,db.DBconn());
        try
        {
            foreach (DataRow studentInfo in ds.Tables[0].Rows)//获取学生数据后,在监督表中查找,有更新,无插入
            {
               //在此之前,需要分别查找select_Result,studentTask,STReport,guiMark,aimCom,并查找论文目录
                int select_Result=0;
                int studentTask=0;
                int STReport=0;
                int guiMark=0;
                int aimCom=0;   
                int fileUpload=0;
               /*****************************************************************************************************************/
                //查询选课结果表
                string sel1="select * from select_Result where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                 DataSet ds2=db.Select(sel1,db.DBconn());
                 select_Result=ds2.Tables[0].Rows.Count;
                 string paperid = "";
                 string title = "";
                 try
                 {
                     paperid = ds2.Tables[0].Rows[0][8].ToString();
                     title = ds2.Tables[0].Rows[0][6].ToString();

                 }
                 catch
                 {
                     //Response.Write("<script>alert('数据库查询选课结果表时出错。');location='Default.aspx'</script>");
                 }
                 finally
                 {
                     ds2.Clear();
                 }
                 
                   
                 //查询学生任务书表
                 sel1="select * from studentTask where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                  ds2=db.Select(sel1,db.DBconn());
                 studentTask=ds2.Tables[0].Rows.Count;
                   ds2.Clear();
                 //查询开题报告表
                 sel1="select * from STReport where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                 ds2=db.Select(sel1,db.DBconn());
                  STReport=ds2.Tables[0].Rows.Count;
                   ds2.Clear();
                 //查询指导记录表
                sel1="select * from guiMark where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                  ds2=db.Select(sel1,db.DBconn());
                  guiMark=ds2.Tables[0].Rows.Count;
                  ds2.Clear();
                 //查询论文小结表
                 sel1="select * from aimCom where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                  ds2=db.Select(sel1,db.DBconn());
                  aimCom=ds2.Tables[0].Rows.Count;
                  ds2.Clear();
                //查询论文是否上传
                 String fileName =  studentInfo["student_ID"].ToString() +  studentInfo["name"].ToString()+title;
                if (File.Exists(Server.MapPath("../论文上传/" + fileName+ ".doc"))||System.IO.File.Exists(Server.MapPath("../论文上传/" + fileName+ ".docx")))//如果不存在就为0
                {
                    fileUpload=1;
                }else{
                     fileUpload=0;
                }

                /*****************************************************************************************************************/
                string student = "select * from inspect where student_ID='" + studentInfo["student_ID"].ToString()+ "'";
                DataSet ds1 = db.Select(student, db.DBconn());
                try//有数据则更新数据
                {
                    string paperid1 = ds1.Tables[0].Rows[0][3].ToString();//用来跳转到catch
                    if (select_Result > 0)//存在则更新
                    {
                        string update = "update inspect set paperid='" + paperid + "',title='" + title + "' where student_ID='" + studentInfo["student_ID"].ToString() + "'";//然后更新学生数据
                        db.Update(update, db.DBconn());
//.........这里部分代码省略.........
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:101,代码来源:inspect.aspx.cs

示例14: Button9_Click

    protected void Button9_Click(object sender, EventArgs e)
    {
        //教师课题修改,当课题审批通过或者不在出题阶段时,无法进行修改

        DB db = new DB();

        String del = "update paperApply set  kind='" + this.kind_Mod.SelectedValue + "',project_Name='" + this.projectName_Mod.Text + "',project_Depart='" + this.projectDpart_Mod.Text + "',project_Num='" + this.projectNum_Mod.Text + "',target='" + this.aim_Mod.Text + "', aim_Meaning='" + this.mean_Mod.Text + "',current_situation='" + this.state_Mod.Text + "', content='" + this.cont_Mod.Text + "',reference='" + this.ref_Mod.Text + "',remark='" + this.remark_Mod.Text + "',schedule='" + this.TextBox8.Text + "' where id='" + Session["id"] + "'";

        if (db.Update(del, db.DBconn()))
        {
            //this.message.Text = "更新题目为" + this.DropDownList1.SelectedValue + "的数据成功";
            Response.Write("<script>alert('更新题目为" + this.Label2.Text + "的数据成功');location='paperOpe.aspx'</script>");
        }
        else
        {
            //  this.message.Text = "更新题目为" + this.DropDownList1.SelectedValue + "的数据失败";
            Response.Write("<script>alert('更新题目为" + this.Label2.Text + "的数据失败');location='paperOpe.aspx'</script>");
        }
    }
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:19,代码来源:paperOpe1.aspx.cs

示例15: Button1_Click

    protected void Button1_Click(object sender, EventArgs e)
    {
         DB db=new DB();
        //首先判断教师中期中数据
     
        string sel="select * from midCheckForTea where teacher_ID='"+Session["username"]+"'";
        DataSet ds=db.Select(sel,db.DBconn());
        if(ds.Tables[0].Rows.Count>0){//有数据则更新操作
            string update="update midCheckForTea set IsOne='"+this.RadioButtonList1.SelectedValue+"',IsTaskGive='"+this.RadioButtonList2.SelectedValue+"',IsrefRead='"+this.RadioButtonList3.SelectedValue+"',IsGuided='"+this.RadioButtonList4.SelectedValue+"',totalsituation='"+this.RadioButtonList5.SelectedValue+"',QA='"+this.TextBox1.Text+"' where teacher_ID='"+Session["username"]+"'";
            if (!db.Update(update, db.DBconn()))
            {   
            Response.Write("<script>alert('中期检查教师表修改失败。');location='midCheckEA.aspx'</script>");
            }

        }else{//无数据则进行插入

            String insert="insert into midCheckForTea(teacher_ID,teacher_Name,Depart,specify,time,guiNum,IsOne,IsTaskGive,IsrefRead,IsGuided,totalsituation,QA,year) values('"+Session["username"]+ "','" + Label4.Text + "','" + Label1.Text+ "','" + Label2.Text + "','" + Label3.Text+ "','" + Label5.Text + "','" +this.RadioButtonList1.SelectedValue  + "','" +this.RadioButtonList2.SelectedValue + "','" + this.RadioButtonList3.SelectedValue  + "','" +this.RadioButtonList4.SelectedValue + "','" +this.RadioButtonList5.SelectedValue + "','" +this.TextBox1.Text + "','" +Session["year"] +"')";
            if (!db.Insert(insert, db.DBconn()))
            {
                Response.Write("<script>alert('中期检查教师表填写失败。');location='midCheckEA.aspx'</script>");
            }

        }
        ds.Clear();
//按照学生情况进行操作***********************************************************************
        if (Button1.Text == "提交")//插入操作
        {
           
             //查找是否存在于表中如果存在则相当已修改,不存在为插入
            string kind=this.RadioButtonList6.SelectedValue;
            if(this.RadioButtonList6.SelectedValue.Equals("其他")&&this.TextBox2.Visible)
            {
                kind = this.TextBox2.Text;
            }
            String insert = "insert into midCheckForStu(teacher_ID,student_ID,student_Name,paperid,title,kind,Ischanged,IsReq,IsCom,Attitude,quality,result,state) values('" + Session["username"] + "','" + Session["student_ID"] + "','" + Label6.Text + "','" + Session["paperid"] + "','" + Label8.Text + "','" +kind + "','" +RadioButtonList7.SelectedValue  + "','" + RadioButtonList8.SelectedValue  + "','" + RadioButtonList9.SelectedValue + "','" + RadioButtonList10.SelectedValue  + "','" +RadioButtonList11.SelectedValue  + "','" + RadioButtonList12.SelectedValue +"','"+"已填写" + "') ";
           if(db.Insert(insert,db.DBconn())){
               Response.Write("<script>alert('中期检查填写成功。');location='midCheckEA.aspx'</script>");
           }
            else{
                Response.Write("<script>alert('中期检查填写失败。');location='midCheckEA.aspx'</script>");
            }
       
        }
        else//更新操作
        {
             string kind=this.RadioButtonList6.SelectedValue;
            if(this.RadioButtonList6.SelectedValue.Equals("其他")&&this.TextBox2.Visible)
            {
                kind=this.TextBox2.Text;

            }

            String update = "update midCheckForStu set kind='" + kind + "',Ischanged='" + this.RadioButtonList7.SelectedValue + "',IsReq='" + this.RadioButtonList8.SelectedValue + "',IsCom='" + this.RadioButtonList9.SelectedValue + "',Attitude='" + this.RadioButtonList10.SelectedValue + "',quality='" + this.RadioButtonList11.SelectedValue + "',result='" + this.RadioButtonList12.SelectedValue + "' where student_ID='" + Session["student_ID"].ToString().Trim() + "'";
            
            if (db.Update(update, db.DBconn()))
            {
                Response.Write("<script>alert('中期检查更新成功。');location='midCheckEA.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('中期检查更新失败。');location='midCheckEA.aspx'</script>");
            }
       
       
    }
    }
开发者ID:zwxscience,项目名称:Paper-management-system,代码行数:66,代码来源:midCheckEA1.aspx.cs


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