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 ImageButton2_Click(object sender, ImageClickEventArgs e) { string userName = username.Text.Trim(); string passWord = password.Text.Trim(); if (string.IsNullOrEmpty(userName)) { Response.Write("<script lanuage=javascript>alert('请输入用户名!');location='javascript:history.go(-1)'</script>"); return; } if (string.IsNullOrEmpty(passWord)) { Response.Write("<script lanuage=javascript>alert('请输入密码!');location='javascript:history.go(-1)'</script>"); return; } string sql = string.Format("SELECT *,userlevelname FROM [userinfo]A,[gy_Userlevel]B where A.userlevelID=B.userlevelID AND username='******' and userpwd='{1}'", userName, Md5.Encrypt(passWord)); SqlData da = new SqlData(); SqlDataReader read = da.ExceRead(sql); read.Read(); if (read.HasRows) { string userlevelname = Convert.ToString(read["userlevelname"]); Session["username"] = this.username.Text; Session["password"] = this.password.Text; Session["userlevel"] = userlevelname; Session["userinfoID"] = read["userinfoID"]; Page.Response.Redirect("chaxun.aspx"); } else { Response.Write("<script lanuage=javascript>alert('用户名或密码有误!');location='javascript:history.go(-1)'</script>"); return; } }
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) { 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 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 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 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); } }
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 Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from tb_Blog where BlogID='" + Session["pwd1"].ToString() + "'"); while (read.Read()) { this.txtPwd.Text = read["PassWord"].ToString(); } read.Close(); } }
protected void Page_Load(object sender, EventArgs e) { SqlData da = new SqlData(); string sqlString = "select * from tb_News"; DataSet ds = da.datesetExecute(sqlString, "tbNews"); DataRow[] row = ds.Tables["tbNews"].Select("id=" + Request.QueryString["id"]); foreach (DataRow rs in row) { // this.labTitle.Text = rs["title"].ToString(); newsContent = rs["content"].ToString(); } }
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 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 Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //if (Session["UserName"] == null) //{ // Response.Redirect("../../Index.aspx"); //} SqlData da = new SqlData(); this.gvAdmin.DataSource = da.ExceDS("select * from tb_Admin"); gvAdmin.DataKeyNames = new string[] { "id" }; gvAdmin.DataBind(); } }
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 Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Session["username"] != null && Session["username"].ToString() != string.Empty) { this.user.Text = Session["username"].ToString(); SqlData da = new SqlData(); string id = Request.QueryString["id"]; if (id != null && id.ToString() != string.Empty) { Button1.Visible = false; string sqlstr = "select * from gy_train where gy_trainID=" + id + " "; SqlDataReader read = da.ExceRead(sqlstr); read.Read(); if (read.HasRows) { this.datetime.Text = read["gy_t_time"].ToString(); this.carNO.Text = read["gy_t_carno"].ToString(); this.shipper.Text = read["gy_t_shipper"].ToString(); this.beginarea.Text = read["gy_t_bgarea"].ToString(); this.consignee.Text = read["gy_t_consignee"].ToString(); this.totalamount.Text = read["gy_t_totalamount"].ToString(); this.factamount.Text = read["gy_t_realamount"].ToString(); this.carriage.Text = read["gy_t_carriage"].ToString(); this.djf.Text = read["gy_t_djf"].ToString(); this.yfk.Text = read["gy_t_yff"].ToString(); this.remark.Text = read["gy_t_remark"].ToString(); this.DropDownList1.SelectedValue = read["jsID"].ToString(); read.Close(); } } else { this.Button2.Visible = false; } } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('您还未登录系统,不能访问此页!请先登录系统。');location='default.aspx'", true); return; } } }
protected void Page_Load(object sender, EventArgs e) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from tb_Admin where UserName='******'"); read.Read(); if (read.HasRows) { this.txtQues.Text = read["Question"].ToString(); } else { Response.Write("<script language=javascript>alert('此用户不存在!');location='Findpwd1.aspx'</script>"); } read.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Session["username"] != null && Session["username"].ToString() != string.Empty) { this.user.Text = Session["username"].ToString(); SqlData da = new SqlData(); string id = Request.QueryString["id"]; if (id != null && id.ToString() != string.Empty) { this.Button2.Visible = false; string sqlstr = "select * from gy_xiao_billno where gy_xiao_billnoID=" + id + " "; SqlDataReader read = da.ExceRead(sqlstr); read.Read(); if (read.HasRows) { this.client.SelectedValue = read["gy_clientID"].ToString(); this.begintime.Text = read["gy_x_b_bgtime"].ToString(); this.endtime.Text = read["gy_x_b_endtime"].ToString(); this.totalcar.Text = read["gy_x_b_totalcar"].ToString(); this.totalamount.Text = read["gy_x_b_totalamount"].ToString(); this.bill.Text = read["gy_x_b_billno"].ToString(); this.gathering.Text = read["gy_x_b_gathering"].ToString(); this.remark.Text = read["gy_x_b_remark"].ToString(); read.Close(); } } else { this.updata.Visible = false; } } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('您还未登录系统,不能访问此页!请先登录系统。');location='default.aspx'", true); return; } } }
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 (this.txtQues.Text == read["Question"].ToString() && this.txtAns.Text == read["Answer"].ToString()) { Session["pwd"] = read["ID"].ToString(); Page.Response.Redirect("ShowPwd.aspx"); } else { Response.Write("<script language=javascript>alert('您输入的信息不正确,请重新输入!');</script>"); } read.Close(); }
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(); }
public static bool Exist(string name) { bool exist = false; SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from gy_KName where K_name='" + name + "'"); read.Read(); if (read.HasRows) { if (name == read["K_name"].ToString()) { exist = true; } } read.Close(); return exist; }
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 jcname_Click(object sender, EventArgs e) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from userinfo where username='******'"); read.Read(); if (read.HasRows) { if (this.username.Text == read["username"].ToString()) { Response.Write("<script lanuage=javascript>alert('对不起,该用户名已经注册!');location='adduser.aspx'</script>"); } } else { Response.Write("<script lanuage=javascript>alert('此用户名可以注册!');</script>"); } read.Close(); }
protected void Button1_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>"); } } else { Response.Write("<script language=javascript>alert('恭喜您,该用户可以注册!');</script>"); } read.Close(); }
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 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 Button3_Click(object sender, EventArgs e) { SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from gy_client where gy_c_name='" + this.username.Text + "'"); read.Read(); if (read.HasRows) { if (this.username.Text == read["username"].ToString()) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('对不起,该用户名已经注册!')", true); } } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "click", "alert('此用户名可以注册!')", true); } read.Close(); }
protected void btnOK_Click(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["CheckCode"]; //判断验证码是否有误 if (cookie.Value != this.txtVali.Text.Trim()) { Response.Write("<script lanuage=javascript>alert('验证码错误');location='javascript:history.go(-1)'</script>"); } else { SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); con.Open(); string strsql = "select count(*) from tb_Admin where UserName='******'and PassWord='******' and SuperAdmin='True'"; SqlCommand com = new SqlCommand(strsql,con); SqlData da = new SqlData(); SqlDataReader read = da.ExceRead("select * from tb_Admin where UserName='******' and PassWord='******'"); read.Read(); if (read.HasRows) { Session["SuperAdmin"] = read["SuperAdmin"].ToString(); } read.Close(); int count = Convert.ToInt32(com.ExecuteScalar()); if (count > 0) { if(object.Equals(Request.Cookies["UserName"],null)) { CreateCookie(); } else { CreateCookie(); } Session["UserName"] = this.txtUid.Text; Session["PassWord"] = this.txtPwd.Text; Page.Response.Redirect("ST_BlogIndex.aspx"); } else { Response.Write("<script lanuage=javascript>alert('用户名或密码有误!');location='javascript:history.go(-1)'</script>"); return; } } }
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); } } }
public static 原料营养值 get原料营养值(string 原料名称) { 原料营养值 ret = new 原料营养值(); SqlData sqlData营养维护 = SqlDataPool.Instance().GetSqlDataByName("营养维护"); object _营养蛋白质 = Common.selectDataItemFromDataSet(sqlData营养维护.mDataSet, "原料名称", 原料名称, "蛋白质"); object _营养脂肪 = Common.selectDataItemFromDataSet(sqlData营养维护.mDataSet, "原料名称", 原料名称, "脂肪"); object _营养糖 = Common.selectDataItemFromDataSet(sqlData营养维护.mDataSet, "原料名称", 原料名称, "糖"); if (_营养蛋白质 != null) { ret.蛋白质 = Convert.ToDouble((string)_营养蛋白质) / 100; } if (_营养脂肪 != null) { ret.脂肪 = Convert.ToDouble((string)_营养脂肪) / 100; } if (_营养糖 != null) { ret.糖 = Convert.ToDouble((string)_营养糖) / 100; } return(ret); }
private void button2_Click(object sender, EventArgs e) { if (!File.Exists("Config.xml")) { SqlData sd = new SqlData(); sd.connStr = TextProcessing.SuperEncrypt(textBox1.Text, "zjsxzsta", "zjsxzstb"); sd.honeybee = TextProcessing.SuperEncrypt(textBox2.Text, "zjsxzsta", "zjsxzstb"); string erro = ""; //判断写入单表xml是否成功 if (!XmlTest <SqlData> .Serialize(sd, "Config.xml", ref erro)) { MessageBox.Show(erro); } //if(FilesClasses.InitXml(textBox1.Text, textBox2.Text)) //{ // textBox2.Text = ""; // textBox1.Text = ""; //} //else //{ // MessageBox.Show("保存错误!"); //} } }
public void UpsertJob_AddNewUniqueJob() { // reset database for test SqlData.DeleteJob("New Unique Job #1"); //Arrange var newJob = new JobDataModel { Id = null, Name = "New Unique Job #1", Type = "Electrical", Date = DateTime.Parse("2018-04-01"), Amount = 125.00M }; //Act var newId = SqlData.UpsertJob(newJob); _outputHelper.WriteLine("[INFO] New job created with Id = {0}", newId?.ToString() ?? "null"); //Assert Assert.NotNull(newId); }
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 (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('" + txtName.Text + "'" + ",'" + txtPwd.Text + "','" + txtQues.Text + "','" + txtAns.Text + "','" + txtRealName.Text + "'" + ",'" + txtBirthday.Text + "','" + txtAddress.Text + "','" + txtPostCode.Text + "','" + txtEmail.Text + "'" + ",'" + txtHphone.Text + "','" + txtMphone.Text + "','" + txtQQ.Text + "','" + txtICQ.Text + "','" + DateTime.Now.ToString() + "','" + DropDownList1.SelectedValue + "','" + DropDownList2.SelectedValue + "','" + Request.UserHostAddress + "')"; 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>"); } }
protected void btnSearch_Click(object sender, EventArgs e) { SqlData da = new SqlData(); string search = ddlSearch.SelectedValue; switch (search) { case "博客ID": da.BindData(gvBlog, "Select * From tb_Blog Where BlogID Like '%" + txtKey.Text + "%'"); break; case "博客姓名": da.BindData(gvBlog, "Select * From tb_Blog Where UserName Like '%" + txtKey.Text + "%'"); break; case "QQ": da.BindData(gvBlog, "Select * From tb_Blog Where QQ Like '%" + txtKey.Text + "%'"); break; default: Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>"); break; } }
private static void LoadCache() { if (DateTime.Now < expiration) { return; } try { rwls.EnterWriteLock(); if (DateTime.Now < expiration) { return; } using (var data = new SqlData()) { cache = new ConcurrentBag <AvgTimeLine>(data.GetAvgTimelines()); } expiration = DateTime.Now.AddHours(2); } finally { rwls.ExitWriteLock(); } }
/// <summary> /// 执行指定SQL 2 /// </summary> /// <param name="Sql">SQL语句</param> /// <returns></returns> public static DataTable Sql2(String Sql) { return(SqlData.Sql2(Sql)); }
public static DataTable GetUserList(string conn) { string cmd = "SELECT user_id, user_name, user_lastseen AS lastseen, user_posts FROM public.users WHERE user_role = 2 ORDER BY (user_id) ASC"; return(SqlData.ExeNpSqlToTable(cmd, conn)); }
public static DataTable GetStreet(string conn, string ward_id) { string cmd = "SELECT * FROM public.street WHERE ward_id = '" + ward_id + "'"; return(SqlData.ExeNpSqlToTable(cmd, conn)); }
protected void lnkEdit_Click(object sender, EventArgs e) { if (Session["user"] == null || Session["access"] != "ADMIN") { Response.Redirect("../index.aspx"); } using (GridViewRow row = (GridViewRow)((ImageButton)sender).Parent.Parent) { editError.Text = string.Empty; ImageButton lnk = (ImageButton)sender; int index = ((GridViewRow)lnk.NamingContainer).RowIndex; Int32 Key = Convert.ToInt32(gvUserProfile.DataKeys[index].Value.ToString()); string strkey = Convert.ToString(Key); SqlData.SelectCommand = "SELECT USERPROFILE.USER_ISN, USERPROFILE.LAST_NAME, USERPROFILE.FIRST_NAME, ISNULL(USERPROFILE.MIDDLE_INITIAL,'') AS MIDDLE_INITIAL, USERPROFILE.EMAIL, USERPROFILE.COLL_CODE_ISN, USERPROFILE.DEPT_CODE_ISN, ISNULL(USERPROFILE.PHONE_NUMBER,'')AS PHONE_NUMBER, ISNULL(USERPROFILE.EXTENSION_NUMBER,'') AS EXTENSION_NUMBER, USERPROFILE.USER_STATUS, USERPROFILE.IS_MASTER_REVIEWER, USERPROFILE.IS_INTERNAL_REVIEWER, USERPROFILE.IS_OFFICIAL_REVIEWER, USERPROFILE.IS_DEVELOPER, USERPROFILE.IS_COORDINATOR, USERPROFILE.ADDED_BY, USERPROFILE.ADDED_DATE, USERPROFILE.UPDATED_BY, USERPROFILE.UPDATED_DATE, ISNULL(USERPROFILE.NOTE,'') AS NOTE, USERPROFILE.LAST_NAME + ', ' + USERPROFILE.FIRST_NAME + ' ' + CASE WHEN USER_STATUS = 1 THEN ' ' ELSE ' - Unavailable' END AS Name, ISNULL(CODE.CODE_DESCRIPTION,'') AS COLLEGE, ISNULL(CODE_1.CODE_DESCRIPTION,'') AS DEPARTMENT FROM USERPROFILE LEFT OUTER JOIN CODE ON CODE.CODE_ISN = USERPROFILE.COLL_CODE_ISN LEFT OUTER JOIN CODE AS CODE_1 ON CODE_1.CODE_ISN = USERPROFILE.DEPT_CODE_ISN WHERE USER_ISN =" + strkey; DataSourceSelectArguments dsArguments = new DataSourceSelectArguments(); DataView dvData = (DataView)SqlData.Select(dsArguments); string strLastName = Convert.ToString(dvData[0].Row["LAST_NAME"]); string strFirstName = (string)dvData[0].Row["FIRST_NAME"]; string strMiddleInitial = (string)dvData[0].Row["MIDDLE_INITIAL"]; string strEmail = (string)dvData[0].Row["EMAIL"]; string strPhoneNumber = (string)dvData[0].Row["PHONE_NUMBER"]; string strExtn = (string)dvData[0].Row["EXTENSION_NUMBER"]; string strUserStatus = Convert.ToString(dvData[0].Row["USER_STATUS"]); string strMR = Convert.ToString(dvData[0].Row["IS_MASTER_REVIEWER"]); string strIR = Convert.ToString(dvData[0].Row["IS_INTERNAL_REVIEWER"]); string strOR = Convert.ToString(dvData[0].Row["IS_OFFICIAL_REVIEWER"]); string strDevr = Convert.ToString(dvData[0].Row["IS_DEVELOPER"]); string strCoordinator = Convert.ToString(dvData[0].Row["IS_COORDINATOR"]); string strAddedBy = (string)dvData[0].Row["Added_By"]; string strAddedDate = Convert.ToString(dvData[0].Row["Added_Date"]); string strUpdatedBy = (string)dvData[0].Row["Updated_By"]; string strUpdatedDate = Convert.ToString(dvData[0].Row["Updated_Date"]); string strCollege = (string)dvData[0].Row["College"]; string strDepartment = (string)dvData[0].Row["Department"]; string strNote = (string)dvData[0].Row["Note"]; userisn.Value = strkey; txtLastName.Text = strLastName; txtFirstName.Text = strFirstName; txtMiddleInitial.Text = strMiddleInitial == " " ? "" : strMiddleInitial; txtEmail.Text = strEmail; SqlData.SelectCommand = "SELECT CODE_ISN FROM CODE WHERE CODE_DESCRIPTION = '" + strCollege + "'"; DataView dvCodeId = (DataView)SqlData.Select(dsArguments); string StrISN; if (dvCodeId.Count > 0) { StrISN = dvCodeId[0].Row["CODE_ISN"].ToString(); dropCollege.SelectedValue = StrISN; } else { dropCollege.SelectedValue = "-1"; } if (dropCollege.SelectedValue != "-1") { SqlData.SelectCommand = "SELECT CODE_ISN FROM CODE WHERE CODE_DESCRIPTION = '" + strDepartment + "'"; dsArguments = new DataSourceSelectArguments(); dvCodeId = (DataView)SqlData.Select(dsArguments); if (dvCodeId.Count > 0) { StrISN = dvCodeId[0].Row["CODE_ISN"].ToString(); dropDepartment.SelectedValue = StrISN; } else { dropDepartment.SelectedValue = "-1"; } } txtContactNumber.Text = strPhoneNumber == " " ? "" : strPhoneNumber; txtExtension.Text = strExtn == " " ? "" : strExtn; rbUserlist.SelectedIndex = Convert.ToByte(strUserStatus == "True" ? "0" : "1"); ckMasterReviewer.Checked = Convert.ToBoolean(strMR); ckInternalReviewer.Checked = Convert.ToBoolean(strIR); ckOfficialReviewer.Checked = Convert.ToBoolean(strOR); ckDeveloper.Checked = Convert.ToBoolean(strDevr); ckCoordinator.Checked = Convert.ToBoolean(strCoordinator); txtNote.Text = strNote == " " ? "" : strNote; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#editModal').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false); } }
public WTPSqlLoader(SqlData SqlData) { this.SqlData = SqlData; Factory = new WTPSqlDataFactory(SqlData); }
/// <summary> /// 执行指定SQL(返回计算后的结果) 2 /// </summary> /// <param name="Sql">SQL语句</param> /// <returns></returns> public static Decimal SqlJiSuanJieGuo2(String Sql) { return(SqlData.SqlJiSuanJieGuo2(Sql)); }
private void DisableDetection_btn_Click(object sender, EventArgs e) { SqlData.CreateConnection(); SqlData.UpdateDG(UserName); }
public static String getNewId() { int id = SqlData.getInstance().getMaxId("news") + 1; return(id.ToString()); }
public static void removeAll(String movieId) { String sql = String.Format("delete from news where movie_id='{0:s}'", movieId); SqlData.getInstance().ExecuteSQL(sql); }
public static void UpdateHistory(string conn, string post_id, string user_id) { string cmd = "INSERT INTO public.history VALUES (" + user_id + ", " + post_id + ", CURRENT_TIME)"; SqlData.ExeNpSqlCmd(cmd, conn); }
public static DataTable GetPostByWard(string conn, string ward_id, string price, string area, string type, string user_id) { string price_cmd; string area_cmd; string type_cmd; if (price == "-1") { price_cmd = " post_price > -1 "; } else { if (price == "10") { price_cmd = " post_price >= 10 "; } else { if (price == "1") { price_cmd = " post_price < 1 "; } else { price_cmd = " post_price >= (" + price + " - 1) AND post_price <= (" + price + " + 1) "; } } } if (area == "-1") { area_cmd = " post_area > -1 "; } else { if (area == "100") { area_cmd = " post_area >= 100 "; } else { if (area == "20") { area_cmd = " post_area < 20 "; } else { area_cmd = " post_area >= (" + area + " - 10) AND post_area <= (" + area + " + 10) "; } } } if (type == "-1") { type_cmd = " (post_type = 'Chung cư' OR post_type = 'Thổ cư') "; } else { type_cmd = " post_type = '" + type + "' "; } if (user_id != null) { user_id = " AND p.user_id = " + user_id; } else { user_id = ""; } string cmd = "SELECT p.* FROM public.post AS p,public.street AS s,public.ward AS w, public.users AS u WHERE u.user_id = p.user_id AND w.ward_id = " + ward_id + " " + user_id + " and w.ward_id = s.ward_id and s.street_id = p.post_address AND" + area_cmd + "AND" + price_cmd + "AND" + type_cmd + " ORDER BY (u.user_subscription) DESC"; //return cmd; return(SqlData.ExeNpSqlToTable(cmd, conn)); }
public ActionResult Index(string pageID, string actionName) { var page = Panasia.Core.App.AppConfig.Current.GetPage(pageID); if (page == null || page.Config == null) { var error = Messages.System_PageNotFound; this.Log(string.Format("Receive Request\tPage:{0},Action:{1}\tError:{2}", pageID, actionName, error)); throw new Exception(error); } if (!page.IsNetAllow()) { throw new Exception(string.Format( LangTexts.Current.GetLangText("1003", "对不起,因网络受限,您不能使用功能[{0}],谢谢理解!"), page.Title)); } #if DEBUG var reloadPage = Request["reloadPage"]; if (!string.IsNullOrEmpty(reloadPage)) { page.ReloadConfig(); } var reloadSql = Request["reloadSql"]; if (!string.IsNullOrEmpty(reloadSql)) { SqlData.ReloadCurrent(); } #endif dynamic mPage = page.Config; try { if (mPage.IsRedirect) { return(RedirectToAction(string.IsNullOrEmpty(actionName) ? mPage.DefaultAction : actionName, mPage.Controller)); } } catch { //如果出错,那么就不是MvcPage } var action = page.Config.Actions[actionName]; if (action == null) { var error = string.Format(Messages.System_ActionNotFound, actionName); this.Log(string.Format("Receive Request\tPage:{0},Action:{1}\tError:{2}", pageID, actionName, error)); throw new Exception(error); } var pageActionValue = SysService.GetCurrentUserPageActionValue(page.PageID); if (pageActionValue == 0) { return(RedirectToAction("TimeOut", "Home")); } if (pageActionValue == 0 || ((pageActionValue & action.ActionValue) != action.ActionValue)) { var error = Messages.System_ActionNotAllowed; this.Log(string.Format("Receive Request\tPage:{0},Action:{1}\tError:{2}", pageID, actionName, error)); throw new Exception(error); } var context = new WebContext { Controller = this, Request = Request.Params, User = User, Page = page, Files = Request.Files, ActionValue = SysService.GetCurrentUserPageActionValue(page.PageID) }; string actionTitle = string.Format("{0}-{1}", page.Title, action.Title); try { StringBuilder sb = new StringBuilder(); sb.Append("{"); foreach (var key in Request.Form.AllKeys) { sb.AppendFormat("{0}:{1};", key, Request.Form[key]); } foreach (var key in Request.QueryString.AllKeys) { sb.AppendFormat("{0}:{1};", key, Request.QueryString[key]); } sb.Append("}"); this.Log(string.Format("Receive Request\tPage:{0},Action:{1},Parameters:{2}", pageID, actionName, sb.ToString())); UserLogService.AddLog(actionTitle, Request.RawUrl, sb.ToString()); var result = context.Execute(action); string eventName = string.Format("{0}/{1}", page.PageID, action.Name); ThreadPool.QueueUserWorkItem((o) => { AppConfig.Current.EventActions.HandleEvents(eventName, context); }); this.Log(string.Format("End Request\tPage:{0},Action:{1}", pageID, actionName)); return(result); } catch (Exception ex) { UserLogService.AddLog(actionTitle, Request.RawUrl, ex.Message); this.Log(string.Format("End Request\tPage:{0},Action:{1} \tError:{2}", pageID, actionName, ex.Message)); throw; } }
public AMA() { sql = new SqlData(); sql.connect(); SetTimer(); }
public static void ApprovePost(string conn, string post_id, string post_approve) { string cmd = "UPDATE public.post SET post_approve = " + post_approve + " WHERE post_id = " + post_id; SqlData.ExeNpSqlCmd(cmd, conn); }
/// <summary> /// 执行指定SQL(返回Hashtable 、分页) 2 /// </summary> /// <param name="TableName">表名</param> /// <param name="SN">SN名</param> /// <param name="Field">要查找的字段,字段不可以写 * ,第一列必须是数据库中的id,如:R_SN,R_Name</param> /// <param name="Order">排序</param> /// <param name="Sql">Sql语句</param> /// <param name="_RecordCount">记录数</param> /// <param name="_PageIndex">页码</param> /// <returns></returns> public static Hashtable Sql_FenYe2(String TableName, String SN, String Field, String Order, String Sql, Int32 _RecordCount, Int32 _PageIndex) { return(SqlData.Sql_FenYe2(TableName, SN, Field, Order, Sql, _RecordCount, _PageIndex)); }
private static void UpdateLogIn(string conn, string username) { string cmd = "UPDATE public.users SET user_lastseen = now() WHERE user_account = '" + username + "'"; SqlData.ExeNpSqlCmd(cmd, conn); }
/// <summary> /// 执行指定SQL(返回数量) 2 /// </summary> /// <param name="Sql">SQL语句</param> /// <returns></returns> public static Int32 SqlCount2(String Sql) { return(SqlData.SqlCount2(Sql)); }
private void SaveUserInfo() { double TotalAmount = 0; DateTime StartDate = new DateTime(); DateTime EndDate = new DateTime(); #region 保存信息 File.Copy(Application.StartupPath + @"\User.xls", Application.StartupPath + @"\UU.xls"); File.Delete(Application.StartupPath + @"\User.xls"); MSExcel.Application excelApp; //Excel应用程序变量 MSExcel.Workbook excelDoc; //Excel文档变量 excelApp = new MSExcel.ApplicationClass(); //初始化 //由于使用的是COM库,因此有许多变量需要用Nothing代替 Object Nothing = Missing.Value; excelDoc = excelApp.Workbooks._Open(Application.StartupPath + @"\UU.xls", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); MSExcel.Worksheet ws = (MSExcel.Worksheet)excelDoc.Sheets[1]; MSExcel.Range r; int ExcelLine = 1; r = ws.get_Range(("A" + 1), ("A" + 1)); while (r.Text.ToString() != "") { ExcelLine++; r = ws.get_Range(("A" + ExcelLine), ("A" + ExcelLine)); } SqlResult = SqlConnection.Query("select CustomerName, PhoneNumber, Address, ContactPerson, CertTypeID, CertNumber from DDCustomerInfo"); SqlData = SqlResult.GetResult(); while (SqlData.Read()) { TotalAmount = 0; r = ws.get_Range(("A" + ExcelLine), ("A" + ExcelLine)); r.Value2 = SqlData[0].ToString(); r = ws.get_Range(("B" + ExcelLine), ("B" + ExcelLine)); r.Value2 = SqlData[1].ToString(); r = ws.get_Range(("C" + ExcelLine), ("C" + ExcelLine)); r.Value2 = SqlData[2].ToString(); r = ws.get_Range(("D" + ExcelLine), ("D" + ExcelLine)); r.Value2 = SqlData[3].ToString(); r = ws.get_Range(("E" + ExcelLine), ("E" + ExcelLine)); r.Value2 = GetCertTypeNameByTypeID(Convert.ToInt32(SqlData[4].ToString())); r = ws.get_Range(("F" + ExcelLine), ("F" + ExcelLine)); r.Value2 = SqlData[5].ToString(); DBFConnection.SetFile(this.DBFPath + @"CUST_RCD.DBF"); DBFConnection.Connect(); DBFResult = DBFConnection.Query("select D_JE, DATE, END_DATE from CUST_RCD.DBF where NAME='" + SqlData[0].ToString() + "'"); DBFData = DBFResult.GetResult(); while (DBFData.Read()) { TotalAmount = TotalAmount + Convert.ToDouble(DBFData[0].ToString()); StartDate = DateTime.Parse(DBFData[1].ToString()); EndDate = DateTime.Parse(DBFData[2].ToString()); } DBFData.Close(); DBFConnection.DisConnect(); r = ws.get_Range(("G" + ExcelLine), ("G" + ExcelLine)); r.Value2 = TotalAmount; r = ws.get_Range(("H" + ExcelLine), ("H" + ExcelLine)); r.Value2 = StartDate.ToShortDateString(); r = ws.get_Range(("I" + ExcelLine), ("I" + ExcelLine)); r.Value2 = EndDate.ToShortDateString(); ExcelLine++; } SqlData.Close(); object format = MSExcel.XlFileFormat.xlWorkbookNormal; excelDoc.SaveAs(Application.StartupPath + @"\User.xls", format, Nothing, Nothing, Nothing, Nothing, MSExcel.XlSaveAsAccessMode.xlExclusive, Nothing, Nothing, Nothing, Nothing, Nothing); excelDoc.Close(Nothing, Nothing, Nothing); excelApp.Quit(); File.Delete(Application.StartupPath + @"\UU.xls"); #endregion }
public static void runSQL(String SQL) { SqlData.runSQLCommand(SQL); }
/// <summary> /// Accesses the stored procedure in the database ProductList to list all the records from Product /// </summary> /// <returns>A DataTable object, or possibly null. The DataTable returned is a collection of all the rows from Product</returns> // V2Generator: Section Start : List public static DataTable ProductList() { // V2Generator: Body Start return(SqlData.getSelectDataTable(SqlData.MASTER, "ProductList")); // V2Generator: Body End }
public static DataTable GetWard(string conn, string district_id) { string cmd = "SELECT * FROM public.ward WHERE district_id = '" + district_id + "'"; return(SqlData.ExeNpSqlToTable(cmd, conn)); }
protected void Page_Load(object sender, EventArgs e) { SqlData da = new SqlData(); string strShiShi = "select top 5 * from tb_News where Categories='时事新闻' order by issueDate desc"; string strEconomic = "select top 5 * from tb_News where Categories='环球经济' order by issueDate desc"; string strMilitary = "select top 5 * from tb_News where Categories='军事世界' order by issueDate desc"; string strScience = "select top 5 * from tb_News where Categories='科学技术' order by issueDate desc"; string strSocial = "select top 5 * from tb_News where Categories='社会百态' order by issueDate desc"; string strSports = "select top 5 * from tb_News where Categories='世界体育' order by issueDate desc"; string strFun = "select top 5 * from tb_News where Categories='娱乐综艺' order by issueDate desc"; string strLife = "select top 5 * from tb_News where Categories='生活理财' order by issueDate desc"; SqlDataReader dar = da.ExecuteRead(strShiShi); dlstShiShi.DataSource = dar; dlstShiShi.DataKeyField = "id"; dlstShiShi.DataBind(); dar.Close(); SqlDataReader sdrEco = da.ExecuteRead(strEconomic); dlstEconomic.DataSource = sdrEco; dlstEconomic.DataKeyField = "id"; dlstEconomic.DataBind(); sdrEco.Close(); SqlDataReader sdrM = da.ExecuteRead(strMilitary); dlstMilitary.DataSource = sdrM; dlstMilitary.DataKeyField = "id"; dlstMilitary.DataBind(); sdrM.Close(); SqlDataReader sdrS = da.ExecuteRead(strScience); dlstScience.DataSource = sdrS; dlstScience.DataKeyField = "id"; dlstScience.DataBind(); sdrS.Close(); SqlDataReader sdrSoc = da.ExecuteRead(strSocial); dlstSocial.DataSource = sdrSoc; dlstSocial.DataKeyField = "id"; dlstSocial.DataBind(); sdrSoc.Close(); SqlDataReader sdrSp = da.ExecuteRead(strSports); dlstSports.DataSource = sdrSp; dlstSports.DataKeyField = "id"; dlstSports.DataBind(); sdrSp.Close(); SqlDataReader sdrFun = da.ExecuteRead(strFun); dlstFun.DataSource = sdrFun; dlstFun.DataKeyField = "id"; dlstFun.DataBind(); sdrFun.Close(); SqlDataReader sdrLife = da.ExecuteRead(strLife); dlstLife.DataSource = sdrLife; dlstLife.DataKeyField = "id"; dlstLife.DataBind(); sdrLife.Close(); }
public static void UpdateUserInfor(string conn, List <string> input, string user_id) { string cmd = "UPDATE public.users SET user_name = '" + input[0] + "', user_address = '" + input[1] + "', user_dob = '" + input[2] + "', user_phonenumber = '" + input[3] + "', user_subscription = '" + input[4] + "', user_password = '******' WHERE user_id = '" + user_id + "'"; SqlData.ExeNpSqlCmd(cmd, conn); }
protected override T[] GetRows <T>() { Type t = Factory.GetClassType <T>(); return(SqlData.GetTable(t).Rows.Cast <T>().ToArray()); }