protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SqlData da = new SqlData(); da.ExceSQL("delete from tb_Blog where BlogID='" + gvBlog.DataKeys[e.RowIndex].Value + "'"); Response.Redirect("BlogManage.aspx"); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { SqlData da = new SqlData(); string P_str_Com = "update tb_Admin set UserName='******',PassWord='******'" + ",Sex='" + this.ddlSex.SelectedValue + "',ReallyName='" + this.txtRealName.Text + "'" + ",Birthday='" + this.txtBirthday.Text + "',Email='" + this.txtEmail.Text + "',HomePhone='" + this.txtHphone.Text + "'" + ",MobilePhone='" + this.txtMphone.Text + "',PostCode='" + this.txtPostCode.Text + "',QQ='" + this.txtQQ.Text + "'" + ",ICQ='" + this.txtICQ.Text + "',Address='" + this.txtAddress.Text + "',Answer='" + this.txtAns.Text + "',Question='" + this.txtQues.Text + "',SuperAdmin='" + this.DropDownList1.SelectedValue + "'" + " where ID='" + Request["ID"] + "'"; bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('修改信息成功!');location='AdminManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改信息失败!');location='javascript:history.go(-1)'</script>"); } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btnUpdate_Click(object sender, EventArgs e) { SqlData da = new SqlData(); string P_str_Com = "update tb_Message set FriendName='" + txtName.Text + "'" + ",Sex='" + DropDownList1.SelectedValue + "',MobilePhone='" + txtMphone.Text + "',PostCode='" + txtPostCode.Text + "'" + ",Birthday='" + txtBirthday.Text + "',Email='" + txtEmail.Text + "',HomePhone='" + txtHphone.Text + "'" + ",ICQ='" + txtICQ.Text + "',Address='" + txtAddress.Text + "',QQ='" + txtQQ.Text + "'" + " where MessageID='" + Request["ID"] + "'"; if (!ValidateDate1(txtBirthday.Text) && !ValidateDate2(txtBirthday.Text) && !ValidateDate3(txtBirthday.Text)) { Response.Write( "<script language=javascript>alert('输入的日期格式有误!');location='javascript:history.go(-1)'</script>"); } bool add = da.ExceSQL(P_str_Com); if (add) { Response.Write("<script language=javascript>alert('修改成功!');location='LinkManManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改失败!');location='javascript:history.go(-1)'</script>"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { SqlData da = new SqlData(); string P_str_Com = "update tb_Admin set UserName='******',PassWord='******'" + ",Sex='" + ddlSex.SelectedValue + "',ReallyName='" + txtRealName.Text + "'" + ",Birthday='" + txtBirthday.Text + "',Email='" + txtEmail.Text + "',HomePhone='" + txtHphone.Text + "'" + ",MobilePhone='" + txtMphone.Text + "',PostCode='" + txtPostCode.Text + "',QQ='" + txtQQ.Text + "'" + ",ICQ='" + txtICQ.Text + "',Address='" + txtAddress.Text + "',Answer='" + txtAns.Text + "',Question='" + txtQues.Text + "',SuperAdmin='" + DropDownList1.SelectedValue + "'" + " where ID='" + Request["ID"] + "'"; bool add = da.ExceSQL(P_str_Com); if (add) { Response.Write("<script language=javascript>alert('修改信息成功!');location='AdminManage.aspx'</script>"); } else { Response.Write( "<script language=javascript>alert('修改信息失败!');location='javascript:history.go(-1)'</script>"); } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void btnOK_Click(object sender, EventArgs e) { string ID; SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); mycon.Open(); DataSet mydataset = new DataSet(); SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog where UserName='******'", mycon); mydataadapter.Fill(mydataset, "tb_Blog"); DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0]; ID = rowview["BlogID"].ToString(); string P_str_Com = "Insert into tb_Message(FriendName,Sex,HomePhone,MobilePhone,QQ,ICQ,Address,Birthday,Email,PostCode,BlogID,IP)" + " values ('" + this.txtName.Text + "','" + this.DropDownList1.SelectedValue + "','" + this.txtHphone.Text + "'" + ",'" + this.txtMphone.Text + "','" + this.txtQQ.Text + "','" + this.txtICQ.Text + "','" + this.txtAddress.Text + "'" + ",'" + this.txtBirthday.Text + "','" + this.txtEmail.Text + "','" + this.txtPostCode.Text + "','" + ID + "','" + Request.UserHostAddress + "')"; SqlData da = new SqlData(); bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('添加成功!');location='LinkManManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('添加失败!');location='javascript:history.go(-1)'</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { string lb = Request.QueryString["查询类别"]; string tj = Request.QueryString["查询条件"]; string lr = Request.QueryString["查询内容"]; string lr1 = Request.QueryString["查询内容1"]; string lr2 = Request.QueryString["查询内容2"]; string id = Request.QueryString["id"]; string userinfoID = Session["userinfoID"].ToString(); SqlData da = new SqlData(); string update = "update gy_train set gy_t_time='" + this.datetime.Text + "',gy_t_carno='" + this.carNO.Text + "',gy_t_shipper='" + this.shipper.Text + "',gy_t_bgarea='" + this.beginarea.Text + "',gy_t_consignee='" + this.consignee.Text + "',gy_t_totalamount='" + this.totalamount.Text + "',gy_t_realamount='" + this.factamount.Text + "',gy_t_carriage='" + this.carriage.Text + "',gy_t_djf='"+this.djf.Text+"',gy_t_yff='"+this.yfk.Text+"',jsID='" + this.DropDownList1.SelectedValue + "',gy_t_remark='" + this.remark.Text + "',userinfoID='" + userinfoID + "' where gy_trainID='"+id+"'"; bool up = da.ExceSQL(update); if (up == true) { string url; url = "chaxun.aspx?查询类别=" + lb + "&查询条件=" + tj + "&查询内容=" + lr + "&查询内容1=" + lr1 + "&查询内容2=" + lr2; Response.Redirect(url); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('更新记录失败!')", true); } }
protected void Button4_Click(object sender, EventArgs e) { string lb = Request.QueryString["查询类别"]; string tj = Request.QueryString["查询条件"]; string lr = Request.QueryString["查询内容"]; string lr1 = Request.QueryString["查询内容1"]; string lr2 = Request.QueryString["查询内容2"]; string userinfoID = Session["userinfoID"].ToString(); string id = Request.QueryString["id"]; SqlData da = new SqlData(); string update = "update gy_Gou set gou_time='" + this.time.Text + "',k_ID='" + this.K_name.SelectedValue + "',gou_amount='" + this.amount.Text + "',gou_price='" + this.price.Text + "',gou_total='" + this.total.Text + "',jsID='" + this.djs.SelectedValue + "',gou_billno='" + this.billno.Text + "',gou_pqyment='" + this.yfk.Text + "',gou_remark='" + this.remark.Text + "',userinfoID='" + userinfoID + "' where gou_ID='" + id + "'"; bool up = da.ExceSQL(update); if (up == true) { string url; url = "chaxun.aspx?查询类别=" + lb + "&查询条件=" + tj + "&查询内容=" + lr + "&查询内容1=" + lr1 + "&查询内容2=" + lr2; Response.Redirect(url); } else { Response.Write("<script lanuage=javascript>alert('更新记录失败!');location='javascript:history.go(-1)'</script>"); } }
protected void btnOK_Click(object sender, EventArgs e) { string ID; SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); mycon.Open(); DataSet mydataset = new DataSet(); SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog where UserName='******'", mycon); mydataadapter.Fill(mydataset, "tb_Blog"); DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0]; ID = rowview["BlogID"].ToString(); string P_str_Com = "Insert into tb_Message(FriendName,Sex,HomePhone,MobilePhone,QQ,ICQ,Address,Birthday,Email,PostCode,BlogID,IP)" +" values ('"+this.txtName.Text+"','"+this.DropDownList1.SelectedValue+"','"+this.txtHphone.Text+"'" +",'"+this.txtMphone.Text+"','"+this.txtQQ.Text+"','"+this.txtICQ.Text+"','"+this.txtAddress.Text+"'" +",'"+this.txtBirthday.Text+"','"+this.txtEmail.Text+"','"+this.txtPostCode.Text+"','"+ID+"','"+Request.UserHostAddress+"')"; SqlData da = new SqlData(); if (!ValidateDate1(txtBirthday.Text) && !ValidateDate2(txtBirthday.Text) && !ValidateDate3(txtBirthday.Text)) { Response.Write("<script language=javascript>alert('输入的日期格式有误!');location='javascript:history.go(-1)'</script>"); } else { bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('添加成功!');location='AddLinkMan.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('添加失败!');location='javascript:history.go(-1)'</script>"); } } }
protected void Button3_Click(object sender, EventArgs e) { string lb = Request.QueryString["查询类别"]; string tj = Request.QueryString["查询条件"]; string lr = Request.QueryString["查询内容"]; string lr1 = Request.QueryString["查询内容1"]; string lr2 = Request.QueryString["查询内容2"]; string userinfoID = Session["userinfoID"].ToString(); string id = Request.QueryString["id"]; SqlData da = new SqlData(); string update = "update gy_yun set gy_y_bgtime='" + this.begintime.Text + "',gy_y_endtime='" + this.endtime.Text + "',gy_clientID='" + this.client.SelectedValue + "',gy_y_carno='" + this.carno.Text + "',gy_y_totalcar='" + this.totalcar.Text + "',gy_y_totalamount='" + this.totalamount.Text + "',gy_y_price='" + Convert.ToString(this.price.Text) + "',gy_y_mileage='" + Convert.ToString(this.mileage.Text) + "',gy_y_total='" + Convert.ToString(this.total.Text) + "',gy_y_bgarea='" + this.begin.Text + "',gy_y_endarea='" + this.end.Text + "',gy_y_remark='" + this.remark.Text + "',userinfoID='" + userinfoID + "' where gy_yunID='"+id+"' "; bool up = da.ExceSQL(update); if (up == true) { string url; url = "chaxun.aspx?查询类别=" + lb + "&查询条件=" + tj + "&查询内容=" + lr + "&查询内容1=" + lr1 + "&查询内容2=" + lr2; Response.Redirect(url); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('更新记录失败!')", true); } }
protected void btnAdd_Click(object sender, EventArgs e) { string ID; string sqlstr = "select * from tb_Blog where UserName='******'"; DataSet mydataset = mydata.GetDataSet(sqlstr, "tb_Blog"); DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0]; ID = rowview["BlogID"].ToString(); //创建插入新文章信息的Sql语句 string com = "Insert into ST_news(ST_n_title,ST_n_author,ST_n_key,ST_n_content,ST_n_iscmd,ST_c_id,BlogID) values('" + txtSubject.Text + "','" + Session["UserName"] + "','" + TextBox1.Text + "','" + article_context.Text + "','" + cbox + "','" + DropDownList1.SelectedValue + "','" + ID + "')"; //调用公共类中的ExceSQL方法,返回一个布尔值 bool add = mydata.ExceSQL(com); if (add) { Response.Write("<script language=javascript>alert('文章添加成功!');location='ArticleManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('文章添加失败!');location='javascript:history.go(-1)'</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { if (Session["userName"] == null) { Response.Write("<script language=javascript>alert('登陆状态失效!请登陆');location='Login.aspx'</script>"); } else { SqlData daWordUpdate = new SqlData(); string sqlString = "Update people set nextWordId=nextWordId+1 where userName='******'"; //Response.Write("1111"); bool isNextWordUpdated = daWordUpdate.ExceSQL(sqlString); //Response.Write("2222"); if (isNextWordUpdated) { SqlData daLearnRec = new SqlData(); // Response.Write(Request.Form["xingbie"].ToString()); string sqlLearningRecord = "Insert into LearningRecord (userName,learnTime) Values('" + Session["userName"] + "','" + DateTime.Now + "')"; daLearnRec.ExceSQL(sqlLearningRecord); Response.Redirect("toMemoryWords.aspx"); } else { Response.Write("<script language=javascript>alert('记录失败!请联系管理员');</script>"); } } }
public void ST_Del_Msg() { string ST_sql = "delete from ST_message where ST_id in ("+ Request.QueryString["id"] +")"; SqlData da = new SqlData(); da.ExceSQL(ST_sql); Response.Redirect("ST_admin_message.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SqlData da = new SqlData(); da.ExceSQL("delete from tb_Message where MessageID='" + GridView1.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("LinkManManage.aspx"); }
protected void btnOK_Click(object sender, EventArgs e) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from tb_Admin where UserName='******'"); read.Read(); if (read.HasRows) { if (this.txtName.Text == read["UserName"].ToString()) { Response.Write("<script language=javascript>alert('对不起,该用户已经注册!');location='Register.aspx'</script>"); return; } } read.Close(); string P_str_Com = "insert into tb_Admin(UserName,PassWord,Question,Answer,ReallyName,Birthday,Address" + ",PostCode,Email,HomePhone,MobilePhone,QQ,ICQ,RegTime,Sex,SuperAdmin,IP) values('" + this.txtName.Text + "'" + ",'" + this.txtPwd.Text + "','" + this.txtQues.Text + "','" + this.txtAns.Text + "','" + this.txtRealName.Text + "'" + ",'" + this.txtBirthday.Text + "','" + this.txtAddress.Text + "','" + this.txtPostCode.Text + "','" + this.txtEmail.Text + "'" + ",'" + this.txtHphone.Text + "','" + this.txtMphone.Text + "','" + this.txtQQ.Text + "','" + this.txtICQ.Text + "','" + DateTime.Now.ToString() + "','" + this.DropDownList1.SelectedValue + "','" + this.DropDownList2.SelectedValue + "','" + Request.UserHostAddress + "')"; bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('注册成功!');location='AdminManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('注册失败!');location='javascript:history.go(-1)'</script>"); } }
protected void btnOK_Click(object sender, EventArgs e) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from tb_Visitor where VisitorName='" + this.txtName.Text + "'"); read.Read(); if (read.HasRows) { if (this.txtName.Text == read["VisitorName"].ToString()) { Response.Write("<script language=javascript>alert('对不起,该用户已经注册!');location='Register.aspx'</script>"); return; } } read.Close(); //若用户名不存在,则执行下面的SQL语句 string Com = "insert into tb_Visitor(VisitorName,PassWord,ReallyName,Birthday,Address,PostCode,Email,HomePhone,MobilePhone,QQ,ICQ,Sex,RegTime,IP,BlogID)" + " values('" + this.txtName.Text + "','" + this.txtPwd.Text + "','" + this.txtRealName.Text + "','" + this.txtBirthday.Text + "'" + ",'" + this.txtAddress.Text + "','" + this.txtPostCode.Text + "','" + this.txtEmail.Text + "','" + this.txtHphone.Text + "'" + ",'" + this.txtMphone.Text + "','" + this.txtQQ.Text + "','" + this.txtICQ.Text + "'" + ",'" + this.DropDownList1.SelectedValue + "','" + DateTime.Now.ToString() + "','" + Page.Request.UserHostAddress + "','" + ID + "')"; da.ExceSQL(Com); string StrName = this.txtName.Text; Response.Redirect("RegSuccess.aspx?VisitorName=" + StrName); }
protected void btnOK_Click(object sender, EventArgs e) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from tb_Admin where UserName='******'"); read.Read(); if (read.HasRows) { if (this.txtName.Text == read["UserName"].ToString()) { Response.Write("<script language=javascript>alert('对不起,该用户已经注册!');location='Register.aspx'</script>"); return; } } read.Close(); string P_str_Com = "insert into tb_Admin(UserName,PassWord,Question,Answer,ReallyName,Birthday,Address" + ",PostCode,Email,HomePhone,MobilePhone,QQ,ICQ,RegTime,Sex,SuperAdmin,IP) values('" + this.txtName.Text + "'" + ",'" + this.txtPwd.Text + "','" + this.txtQues.Text + "','" + this.txtAns.Text + "','" + this.txtRealName.Text + "'" + ",'" + this.txtBirthday.Text + "','" + this.txtAddress.Text + "','" + this.txtPostCode.Text + "','" + this.txtEmail.Text + "'" + ",'" + this.txtHphone.Text + "','" + this.txtMphone.Text + "','" + this.txtQQ.Text + "','" + this.txtICQ.Text + "','" + DateTime.Now.ToString() + "','" + this.DropDownList1.SelectedValue + "','"+this.DropDownList2.SelectedValue+"','"+Request.UserHostAddress+"')"; bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('注册成功!');location='AdminManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('注册失败!');location='javascript:history.go(-1)'</script>"); } }
public void ST_Del_Msg() { string ST_sql = "delete from ST_message where ST_id in (" + Request.QueryString["id"] + ")"; SqlData da = new SqlData(); da.ExceSQL(ST_sql); Response.Redirect("ST_admin_message.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //调用公共类中的ExceSQL执行删除操作的SQL语句,并将返回的值保存在定义的布尔类型的变量 delete中 bool delete = da.ExceSQL("delete from ST_news where ST_n_id='" + GridView1.DataKeys[e.RowIndex].Value + "'"); //判断是否删除成功 if (delete) { //删除成功,弹出成功对话框 Response.Write("<script language=javascript>alert('删除成功!');location='ArticleManage.aspx'</script>"); } else { //删除失败,弹出失败提示框 Response.Write("<script language=javascript>alert('删除失败!');location='ArticleManage.aspx'</script>"); } }
public void ST_Shf_Msg() { string substr = ""; string ST_sql = "update ST_message set ST_hf='"+Request.Form["content"]+"' where ST_id = "+ Request.QueryString["id"] +""; SqlData da = new SqlData(); da.ExceSQL(ST_sql); Response.Redirect("ST_admin_message.aspx"); }
public void ST_Shf_Msg() { string substr = ""; string ST_sql = "update ST_message set ST_hf='" + Request.Form["content"] + "' where ST_id = " + Request.QueryString["id"] + ""; SqlData da = new SqlData(); da.ExceSQL(ST_sql); Response.Redirect("ST_admin_message.aspx"); }
protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e) { string P_str_strid = this.DataList1.DataKeys[e.Item.ItemIndex].ToString(); //获取当前DataList控件列 string com = "Delete from tb_Revert where RevertID='" + Convert.ToInt32(P_str_strid) + "'"; SqlData da = new SqlData(); da.ExceSQL(com); Page.Response.Redirect("ReplyManage.aspx?ArticleID=" + Request["ArticleID"] + ""); }
protected void btmAdd_Click(object sender, EventArgs e) { ST_myConn.Open(); if (this.typename.Text != "") { string sqlstr1 = "select count(*) from ST_class where ST_c_name='" + typename.Text.ToString() + "'"; SqlCommand mycom = new SqlCommand(sqlstr1, ST_myConn); int intcount = Convert.ToInt32(mycom.ExecuteScalar()); if (intcount > 0) { Response.Write("<script>alert('对不起!不允许添加相同记录!');location='BlogType.aspx'</script>"); } else { string ST_sql = "insert into ST_class (ST_c_name,ST_date) values ('" + typename.Text.ToString() + "','" + DateTime.Now.ToString() + "')"; My_sqldata.ExceSQL(ST_sql); Response.Write("<script>alert('添加成功!');location='BlogType.aspx'</script>"); } } }
protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e) { string strid = this.DataList1.DataKeys[e.Item.ItemIndex].ToString(); //获取当前DataList控件列 Response.Write(strid); string com = "Delete from tb_Revert where RevertID='" + Convert.ToInt32(strid) + "'"; SqlData da = new SqlData(); da.ExceSQL(com); Page.Response.Redirect("ReplyManage2.aspx"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { //if ("是" == Session["SuperAdmin"].ToString()) //{ SqlData da = new SqlData(); da.ExceSQL("delete from tb_Admin where ID='" + gvAdmin.DataKeys[e.RowIndex].Value + "'"); Page.Response.Redirect("AdminManage.aspx"); //} //else //{ // Response.Write("<script language=javascript>alert('非超级管理员不能进行删除操作!')</script>"); //} }
protected void btmAdd_Click(object sender, EventArgs e) { ST_myConn.Open(); if (this.typename.Text != "") { string sqlstr1 = "select count(*) from ST_class where ST_c_name='" + typename.Text.ToString() + "'and BlogID='" + ID + "'"; SqlCommand mycom = new SqlCommand(sqlstr1, ST_myConn); int intcount = Convert.ToInt32(mycom.ExecuteScalar()); if (intcount > 0) { Response.Write("<script>alert('对不起!不允许添加相同记录!');location='BlogType.aspx'</script>"); } else { string ST_sql = "insert into ST_class (ST_c_name,BlogID) values ('" + typename.Text.ToString() + "','" + ID + "')"; My_sqldata.ExceSQL(ST_sql); Response.Write("<script>alert('添加成功!');location='BlogType.aspx'</script>"); } } //SqlData da = new SqlData(); //da.BindData(this.ClassList, "Select * From ST_class Where ST_c_id Like '%" + this.txtKey.Text + "%'and BlogID='" + ID + "'"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SqlData da = new SqlData(); bool delete = da.ExceSQL("delete from tb_Article where ArticleID='" + GridView1.DataKeys[e.RowIndex].Value + "'"); if (delete) { Response.Write("<script language=javascript>alert('删除成功!');location='ArticleManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('删除失败!');location='ArticleManage.aspx'</script>"); } }
protected void Button1_Click1(object sender, EventArgs e) { if (nickname.Text.Trim() == "" || title.Text.ToString().Trim() == "" || content.Value.Trim() == "") { Response.Write("<script language=javascript>alert('昵称,标题,内容不能为空!!');location='javascript:history.go(-1)'</script>"); Response.End(); } else { string ST_sql = "insert into ST_message (ST_nickname,ST_title,ST_content) values ('" + nickname.Text + "','" + title.Text + "','" + content.Value + "')"; mySqlData.ExceSQL(ST_sql); Response.Redirect("message.aspx"); } }
protected void btnOK_Click(object sender, EventArgs e) { SqlData da = new SqlData(); string P_str_Com = "update tb_Blog set UserName='******',PassWord='******',Sex='" + this.ddlSex.SelectedValue + "',ReallyName='" + this.txtRealName.Text + "',Email='" + this.txtEmail.Text + "',HomePhone='" + this.txtHphone.Text + "',MobilePhone='" + this.txtMphone.Text + "',PostCode='" + this.txtPostCode.Text + "',Address='" + this.txtAddress.Text + "',Answer='" + this.txtAns.Text + "',Subject='" + this.txtSubject.Text + "',Question='" + this.txtQues.Text + "' where BlogID='" + Request["id"] + "'"; bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('信息修改成功!');location='BlogManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('信息修改失败!');location='javascript:history.go(-1)'</script>"); } }
protected void btnOK_Click(object sender, EventArgs e) { string P_str_Com = "insert into ST_link(ST_l_name,ST_l_url) values('" + this.txtNmae.Text + "','" + this.txtUrl.Text + "')"; SqlData da = new SqlData(); bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('链接添加成功!');location='LinkManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('链接添加失败!');location='javascript:history.go(-1)'</script>"); } }
protected void txtOK_Click(object sender, EventArgs e) { if (Session["VisitorName"] == null) { int id; string str2; string str = Request["ArticleID"].ToString(); string com = "select * from tb_Article where ArticleID='" + str + "'"; SqlData da = new SqlData(); SqlDataReader read = da.ExceRead(com); read.Read(); id = Convert.ToInt32(read["BlogID"]); str2 = Convert.ToString(read["Subject"]); read.Close(); string Com = "insert into tb_Revert(VisitorName,Subject,Content,IP,Time,ArticleID,BlogID) values('匿名','" + str2 + "','" + this.txtContent.Text + "','" + Request.UserHostAddress.ToString() + "','" + DateTime.Now.ToString() + "','" + str + "','" + id + "')"; bool add = da.ExceSQL(Com); if (add) { Response.Write("<script language=javascript>alert('提交成功!');location='../../Module/Visitor/Index.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('提交失败!');location='javascript:history.go(-1)'</script>"); } } else { int id; string str2; string str = Request["ArticleID"].ToString(); string com = "select * from tb_Article where ArticleID='" + str + "'"; SqlData da = new SqlData(); SqlDataReader read = da.ExceRead(com); read.Read(); id = Convert.ToInt32(read["BlogID"]); str2 = Convert.ToString(read["Subject"]); read.Close(); string Com = "insert into tb_Revert(VisitorID,VisitorName,Subject,Content,IP,Time,ArticleID,BlogID) values('" + this.txtID.Text + "','" + Session["VisitorName"].ToString() + "','" + str2 + "','" + this.txtContent.Text + "','" + Request.UserHostAddress.ToString() + "','" + DateTime.Now.ToString() + "','" + str + "','" + id + "')"; bool add = da.ExceSQL(Com); if (add == true) { Response.Write("<script language=javascript>alert('提交成功!');location='../../Module/Visitor/Index.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('提交失败!');location='javascript:history.go(-1)'</script>"); } } }
protected void btnOK_Click(object sender, EventArgs e) { //定义一个SqlData的新实例对象 SqlData da = new SqlData(); //调用公共类的ExceRead方法,返回SqlDataReader类型的数据 SqlDataReader read = da.ExceRead("select * from tb_Blog where UserName='******'"); //读取数据库中的数据 read.Read(); //判断用户是否已经注册 if (read.HasRows) { if (txtName.Text == read["UserName"].ToString()) { Response.Write("<script language=javascript>alert('对不起,该用户已经注册!');location='Register.aspx'</script>"); return; } } read.Close(); //定义一个字符串,插入相关的用户注册信息 string P_str_Com = "insert into tb_Blog(UserName,PassWord,ReallyName,Birthday,Address,PostCode,Subject,Email,HomePhone,MobilePhone,QQ,ICQ, Question,Answer,Sex,RegTime,IP)" + " values('" + txtName.Text + "','" + txtPwd.Text + "','" + txtRealName.Text + "','" + txtBirthday.Text + "'" + ",'" + txtAddress.Text + "','" + txtPostCode.Text + "','" + txtSubject.Text + "','" + txtEmail.Text + "'" + ",'" + txtHphone.Text + "','" + txtMphone.Text + "','" + txtQQ.Text + "','" + txtICQ.Text + "','" + txtQues.Text + "'" + ",'" + txtAns.Text + "','" + ddlSex.SelectedValue + "','" + DateTime.Now.ToString() + "','" + Page.Request.UserHostAddress + "')"; if (!ValidateDate1(txtBirthday.Text) && !ValidateDate2(txtBirthday.Text) && !ValidateDate3(txtBirthday.Text)) { Response.Write("<script language=javascript>alert('输入的生日日期格式有误!');location='Register.aspx'</script>"); } else { //调用公共类中的ExceSQL方法,执行insert语句 bool add = da.ExceSQL(P_str_Com); if (add) { Response.Write("<script language=javascript>alert('恭喜您!注册成功!');location='../../BlogIndex.aspx'</script>"); } else { Response.Write( "<script language=javascript>alert('对不起!您注册失败!');location='javascript:history.go(-1)'</script>"); } } }
protected void Button2_Click(object sender, EventArgs e) { ST_myConn.Open(); for (int i = 0; i <= ReplayList.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)ReplayList.Rows[i].FindControl("CheckBox1"); if (cbox.Checked) { string sqlstr = "delete from ST_replay where ST_r_id='" + ReplayList.DataKeys[i].Value + "'"; sd.ExceSQL(sqlstr); } } ST_Replay_Bind(); }
protected void btnChange_Click(object sender, EventArgs e) { string P_str_Com = "update tb_Admin set PassWord='******' where ID='" + Session["pwd"] + "'"; SqlData da = new SqlData(); bool add = da.ExceSQL(P_str_Com); if (add) { Response.Write("<script language=javascript>alert('修改成功!');location='Index.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改失败!');location='javascript:history.go(-1)'</script>"); } }
protected void btnAmend_Click(object sender, EventArgs e) { string P_str_Com = "update ST_link set ST_l_name='" + this.txtName.Text + "',ST_l_url='" + this.txtUrl.Text + "' where ST_l_id='" + Request["id"] + "'"; SqlData da = new SqlData(); bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('修改链接成功!');location='LinkManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改链接失败!');location='javascript:history.go(-1)'</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { //mycon.Open(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1"); if (cbox.Checked == true) { string sqlstr = "delete from ST_news where ST_n_id='" + GridView1.DataKeys[i].Value + "'"; da.ExceSQL(sqlstr); Response.Write("<script language=javascript>alert('批量删除成功!');location='ArticleManage.aspx'</script>"); } } }
protected void btnOK_Click(object sender, EventArgs e) { string ID; SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); mycon.Open(); DataSet mydataset = new DataSet(); SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog where UserName='******'", mycon); mydataadapter.Fill(mydataset, "tb_Blog"); DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0]; ID = rowview["BlogID"].ToString(); string P_str_filePath = "", P_str_fileExtName = "", P_str_mFileName, P_str_mPath; StringBuilder strMsg = new StringBuilder("上传文件信息;<hr color=red>"); if ("" != fileUp.PostedFile.FileName) { P_str_filePath = fileUp.PostedFile.FileName; //获取文件路径 P_str_fileExtName = P_str_filePath.Substring(P_str_filePath.LastIndexOf(".") + 1); //获得扩展名 try { string personPhoto = Session["UserName"].ToString(); P_str_mPath = Server.MapPath("../../Images/Pictures/" + personPhoto + "/"); //保存到指定的路径 P_str_mFileName = P_str_filePath.Substring(P_str_filePath.LastIndexOf("\\") + 1); //获得文件的名称 fileUp.PostedFile.SaveAs(P_str_mPath + P_str_mFileName); //保存到指定的路径下 string P_str_Com = "insert into tb_Picture(Subject,ImageUrl,BlogID) values('" + txtSubject.Text + "','../../Images/Pictures/" + personPhoto + "/" + P_str_mFileName + "','" + ID + "')"; SqlData da = new SqlData(); bool add = da.ExceSQL(P_str_Com); if (add) { Response.Write("<script language=javascript>alert('添加成功!');location='PhotoManage.aspx'</script>"); } else { Response.Write( "<script language=javascript>alert('添加失败!');location='javascript:history.go(-1)'</script>"); } } catch (Exception err) { Response.Write(err.ToString()); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { string id = Request["id"].ToString(); string Com = "update tb_Article set Content='" + this.txtContent.Text + "' where ArticleID='" + id + "'"; SqlData da = new SqlData(); bool update = da.ExceSQL(Com); if (update) { Response.Write("<script language=javascript>alert('修改成功!');location='ArticleManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改失败!');</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { SqlData sd = new SqlData(); ST_myConn.Open(); for (int i = 0; i <= this.MessageList.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)MessageList.Rows[i].FindControl("CheckBox1"); if (cbox.Checked == true) { string sqlstr = "delete from ST_message where ST_id='" + MessageList.DataKeys[i].Value + "'"; sd.ExceSQL(sqlstr); } } ST_Link_Bind(); }
protected void ReplayList_RowDeleting(object sender, GridViewDeleteEventArgs e) { //创建公共类SqlData的一个新实例对象 SqlData da = new SqlData(); //调用公共类中的ExceSQL,执行删除的SQL语句 bool delete = da.ExceSQL("delete from ST_replay where ST_r_id='" + ReplayList.DataKeys[e.RowIndex].Value.ToString() + "'"); if (delete) { Response.Write("<script language=javascript>alert('删除成功!');location='ST_admin_replay.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('删除失败!');location='ST_admin_replay.aspxx'</script>"); } }
protected void btnChange_Click(object sender, EventArgs e) { if (Session["pwd1"] != null) { string com = "update tb_Blog set PassWord='******' where BlogID='" + Session["pwd1"].ToString() + "'"; SqlData da = new SqlData(); bool add = da.ExceSQL(com); if (add) { Response.Write("<script language=javascript>alert('修改成功!');location='../../BlogIndex.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改失败!');location='javascript:history.go(-1)'</script>"); } } }
protected void okbtn_Click(object sender, EventArgs e) { if (this.userpwd.Text != this.userpwd1.Text) { Response.Write("<script lanuage=javascript>alert('您输入的密码不一致!');location='javascript:history.go(-1)'</script>"); } SqlData da = new SqlData(); string useradd = "insert into userinfo(username,userpwd,userlevelID,usersexID)values('" + this.username.Text + "','" +Md5.Encrypt(this.userpwd.Text) + "','" + this.userlevel.SelectedValue + "','" + this.usersex.SelectedValue + "')"; bool add = da.ExceSQL(useradd); if (add == true) { Response.Write("<script lanuage=javascript>alert('注册成功!');</script>"); } else { Response.Write("<script lanuage=javascript>alert('注册失败!');location='javascript:history.go(-1)'</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { if (Page.IsValid) { SqlData da = new SqlData(); string useradd = "insert into gy_client (gy_c_name,gy_c_phone,gy_c_address,gy_c_Email,gy_c_remark)values('" + this.username.Text + "','" + this.phone.Text + "','" + this.addres.Text + "','" + this.E_mail.Text + "','" + this.remark.Text + "')"; bool add = da.ExceSQL(useradd); if (add) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('数据添加成功');location='addclient.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('注册失败!')", true); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtContent.Text)) { string id = Request["id"].ToString(); string Com = "update ST_news set ST_n_content='" + this.txtContent.Text + "' where ST_n_id='" + id + "'"; //创建公共类SqlData的一个新的实例对象 SqlData da = new SqlData(); bool update = da.ExceSQL(Com); if (update) { Response.Write("<script language=javascript>alert('修改成功!');location='ArticleManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改失败!');</script>"); } } }
protected void Button2_Click(object sender, EventArgs e) { if (Page.IsValid) { string userinfoID = Session["userinfoID"].ToString(); SqlData da = new SqlData(); string addxiao = "insert into gy_yun(gy_y_bgtime,gy_y_endtime,gy_clientID,gy_y_carno,gy_y_totalcar,gy_y_totalamount,gy_y_price,gy_y_mileage,gy_y_total,gy_y_bgarea,gy_y_endarea,gy_y_remark,userinfoID)values('" + this.begintime.Text + "','" + this.endtime.Text + "','" + this.client.SelectedValue + "','" + this.carno.Text + "','" + this.totalcar.Text + "','" + this.totalamount.Text + "','" + Convert.ToString(this.price.Text) + "','" + Convert.ToString(this.mileage.Text) + "','" + Convert.ToString(this.total.Text) + "','" + this.begin.Text + "','" + this.end.Text + "','" + this.remark.Text + "','"+userinfoID+"')"; bool add = da.ExceSQL(addxiao); if (add == true) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录成功!');location='addyun.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录失败!')", true); } } }
protected void Button2_Click(object sender, EventArgs e) { if (Page.IsValid) { string userinfoID = Session["userinfoID"].ToString(); SqlData da = new SqlData(); string addxiaopiao = "insert into gy_xiao_billno(gy_clientID,gy_x_b_bgtime,gy_x_b_endtime,gy_x_b_totalcar,gy_x_b_totalamount,gy_x_b_billno,gy_x_b_totalmoney,gy_x_b_gathering,gy_x_b_remark,userinfoID)values('" + this.client.SelectedValue + "','" + this.begintime.Text + "','" + this.endtime.Text + "','" + this.totalcar.Text + "','" + this.totalamount.Text + "','" + this.bill.Text + "','" + this.totalmoney.Text + "','" + this.gathering.Text + "','" + this.remark.Text + "','"+userinfoID+"')"; bool add = da.ExceSQL(addxiaopiao); if (add == true) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录成功!');location='addxiaopiao.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录失败!')", true); } } }
protected void Button1_Click(object sender, EventArgs e) { if (Page.IsValid) { string userinfoID = Session["userinfoID"].ToString(); SqlData da = new SqlData(); string useradd = "insert into gy_gou(gou_time,k_ID,gou_amount,gou_price,gou_total,jsID,gou_billno,gou_pqyment,gou_remark,userinfoID)values('" + this.time.Text + "','" + this.K_name.SelectedValue + "','" + this.amount.Text + "','" + this.price.Text + "','" + this.total.Text + "','" + this.djs.SelectedValue + "','" + this.billno.Text + "','" + this.yfk.Text + "','" + this.remark.Text + "','" + userinfoID + "')"; bool add = da.ExceSQL(useradd); if (add == true) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('数据添加成功');location='addgou.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录失败');location='addgou.aspx'", true); } } }
protected void btnOK_Click(object sender, EventArgs e) { string ID; SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); mycon.Open(); DataSet mydataset = new DataSet(); SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog where UserName='******'", mycon); mydataadapter.Fill(mydataset, "tb_Blog"); DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0]; ID = rowview["BlogID"].ToString(); string P_str_filePath = "", P_str_fileExtName = "", P_str_mFileName, P_str_mPath; System.Text.StringBuilder strMsg = new System.Text.StringBuilder("上传文件信息;<hr color=red>"); if ("" != fileUp.PostedFile.FileName) { P_str_filePath = fileUp.PostedFile.FileName;//获取文件路径 P_str_fileExtName = P_str_filePath.Substring(P_str_filePath.LastIndexOf(".") + 1);//获得扩展名 try { string personPhoto = Session["UserName"].ToString(); P_str_mPath = Server.MapPath("../../Images/Pictures/"+personPhoto+"/");//保存到指定的路径 P_str_mFileName =P_str_filePath.Substring(P_str_filePath.LastIndexOf("\\") + 1);//获得文件的名称 fileUp.PostedFile.SaveAs(P_str_mPath + P_str_mFileName);//保存到指定的路径下 string P_str_Com = "insert into tb_Picture(Subject,ImageUrl,BlogID) values('" + this.txtSubject.Text + "','../../Images/Pictures/" + personPhoto + "/" + P_str_mFileName + "','" + ID + "')"; SqlData da = new SqlData(); bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('添加成功!');location='PhotoManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('添加失败!');location='javascript:history.go(-1)'</script>"); } } catch (Exception err) { Response.Write(err.ToString()); } } }
protected void botton2_Click(object sender, EventArgs e) { if (Page.IsValid) { string userinfoID = Session["userinfoID"].ToString(); SqlData da = new SqlData(); string addxiao = "insert into gy_xiao(gy_x_time,gy_x_carno,gy_x_voucher,gy_clientID,gy_x_amount,gy_x_price,gy_x_total,jsID,gy_x_remark,userinfoID)values('" + this.time.Text + "','" + this.carno.Text + "','" + this.voucher.Text + "','" + this.client.SelectedValue + "','" + this.amount.Text + "','" + Convert.ToString(this.price.Text) + "','" + Convert.ToString(this.total.Text) + "','" + this.DropDownList1.SelectedValue + "','" + this.remark.Text + "','"+userinfoID+"')"; bool add = da.ExceSQL(addxiao); if (add == true) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录成功!');location='addxiao.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录失败!')", true); } } }
protected void Button1_Click(object sender, EventArgs e) { if (IsValid) { //执行需要的代码 string userinfoID = Session["userinfoID"].ToString(); SqlData da = new SqlData(); string useradd = "insert into gy_train(gy_t_time,gy_t_carno,gy_t_shipper,gy_t_bgarea,gy_t_consignee,gy_t_totalamount,gy_t_realamount,gy_t_carriage,jsID,gy_t_djf,gy_t_yff,gy_t_remark,userinfoID)values('" + this.datetime.Text + "','" + this.carNO.Text + "','" + this.shipper.Text + "','" + this.beginarea.Text + "','" + this.consignee.Text + "','" + this.totalamount.Text + "','" + this.factamount.Text + "','" + this.carriage.Text + "','" + this.DropDownList1.SelectedValue + "','"+this.djf.Text+"','"+this.yfk.Text+"','" + this.remark.Text + "','"+userinfoID+"')"; bool add = da.ExceSQL(useradd); if (add == true) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录成功!');location='addtrain.aspx'", true); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('添加记录失败!')", true); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { SqlData da = new SqlData(); string P_str_Com = "update tb_Message set FriendName='" + this.txtName.Text + "'" + ",Sex='" + this.DropDownList1.SelectedValue + "',MobilePhone='" + this.txtMphone.Text + "',PostCode='" + this.txtPostCode.Text + "'" + ",Birthday='" + this.txtBirthday.Text + "',Email='" + this.txtEmail.Text + "',HomePhone='" + this.txtHphone.Text + "'" + ",ICQ='" + this.txtICQ.Text + "',Address='" + this.txtAddress.Text + "',QQ='" + this.txtQQ.Text + "'" + " where MessageID='" + Request["ID"] + "'"; if (!ValidateDate1(txtBirthday.Text) && !ValidateDate2(txtBirthday.Text) && !ValidateDate3(txtBirthday.Text)) { Response.Write("<script language=javascript>alert('输入的日期格式有误!');location='javascript:history.go(-1)'</script>"); } bool add = da.ExceSQL(P_str_Com); if (add == true) { Response.Write("<script language=javascript>alert('修改成功!');location='LinkManManage.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('修改失败!');location='javascript:history.go(-1)'</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { string lb = Request.QueryString["查询类别"]; string tj = Request.QueryString["查询条件"]; string lr = Request.QueryString["查询内容"]; string lr1 = Request.QueryString["查询内容1"]; string lr2 = Request.QueryString["查询内容2"]; string id = Request.QueryString["id"]; SqlData da = new SqlData(); string update = "update gy_client set gy_c_name='" + this.username.Text + "',gy_c_phone='" + this.phone.Text + "',gy_c_address='" + this.addres.Text + "',gy_c_Email='" + this.E_mail.Text + "',gy_c_remark='" + this.remark.Text + "' where gy_clientID='" + id + "'"; bool up = da.ExceSQL(update); if (up) { string url; url = "chaxun.aspx?查询类别=" + lb + "&查询条件=" + tj + "&查询内容=" + lr + "&查询内容1=" + lr1 + "&查询内容2=" + lr2; Response.Redirect(url); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('更新记录失败!')", true); } }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="userInfo"></param> /// <returns></returns> public static bool Update(UserInfo userInfo) { SqlData da = new SqlData(); string update = "update userinfo set username='******',userpwd='" +userInfo.UserPwd + "',usersexID='" + userInfo.usersexID + "',userlevelID='" + userInfo.userlevelID + "' where userinfoID='" + userInfo.userinfoID + "'"; return da.ExceSQL(update); }
/// <summary> /// 删除用户 /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool Delete(int id) { string sql = "delete from userinfo where userinfoID='" + id + "'"; SqlData da = new SqlData(); return da.ExceSQL(sql); }
/// <summary> /// 添加用户 /// </summary> /// <param name="userName">用户名</param> /// <param name="password">加密后的密码</param> /// <param name="level">用户级别</param> /// <param name="sex">用户性别</param> /// <returns></returns> public static bool Add(string userName,string password,int level,int sex) { SqlData da = new SqlData(); string useradd = string.Format("insert into userinfo(UserName,UserPwd,userlevelID,usersexID)values('{0}','{1}','{2}','{3}')", userName, password, level, sex); return da.ExceSQL(useradd); }
protected void ReplayList_RowDeleting(object sender, GridViewDeleteEventArgs e) { //����������SqlData��һ����ʵ������ SqlData da = new SqlData(); //���ù������е�ExceSQL,ִ��ɾ����SQL��� bool delete = da.ExceSQL("delete from ST_replay where ST_r_id='" + ReplayList.DataKeys[e.RowIndex].Value.ToString() + "'"); if (delete) { Response.Write("<script language=javascript>alert('ɾ���ɹ���');location='ST_admin_replay.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('ɾ��ʧ�ܣ�');location='ST_admin_replay.aspxx'</script>"); } }
protected void total_Click(object sender, EventArgs e) { string lb = Request.QueryString["查询类别"]; string tj = Request.QueryString["查询条件"]; string lr = Request.QueryString["查询内容"]; string lr1 = Request.QueryString["查询内容1"]; string lr2 = Request.QueryString["查询内容2"]; string userinfoID = Session["userinfoID"].ToString(); string id = Request.QueryString["id"]; SqlData da = new SqlData(); string update = "update gy_xiao_billno set gy_clientID='" + this.client.SelectedValue + "',gy_x_b_bgtime='" + this.begintime.Text + "',gy_x_b_endtime='" + this.endtime.Text + "',gy_x_b_totalcar='" + this.totalcar.Text + "',gy_x_b_totalamount='" + this.totalamount.Text + "',gy_x_b_billno='" + this.bill.Text + "',gy_x_b_totalmoney='" + this.totalmoney.Text + "',gy_x_b_gathering='" + this.gathering.Text + "',gy_x_b_remark='" + this.remark.Text + "',userinfoID='" + userinfoID + "'where gy_xiao_billnoID='"+id+"' "; bool up = da.ExceSQL(update); if (up == true) { string url; url = "chaxun.aspx?查询类别=" + lb + "&查询条件=" + tj + "&查询内容=" + lr + "&查询内容1=" + lr1 + "&查询内容2=" + lr2; Response.Redirect(url); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('更新记录失败!')", true); } }