• 数据库写入操作


    1.写入

    DataAccess.Da dac = new DataAccess.Da();

    string strCity = this.s_city.Text;
    string strb = this.TextBox1.Text;

    string sql = "insert into city_info(city,sort) values ('" + strCity + "','" + strb + "')";

    dac.ExecuteSql(sql);
    Response.Write("<script> alert('添加成功!');window.location.href=window.location.href; </script> ");

    2.修改

    int id = Convert.ToInt32(Session["userid"]);
    string strimg = imgUpload.ImageUrl;
    string strnicheng = this.TextBox1.Text;
    string strshouji = this.TextBox2.Text;
    string stremail = this.TextBox3.Text;


    string sql = "update tb_user set nicheng = '" + strnicheng + "',shouji = '" + strshouji + "',youxiang = ' " + stremail + "' ,touxiang = ' " + strimg + "'where ID =" + id;
    BaseClass.ExecNonQuery(sql);


    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript> alert('修改成功!');window.location.href=window.location.href;</script>");

  • 相关阅读:
    敏捷开发宣言
    OpenGL SL 优化要点
    Cocoa Touch 开发框架
    MSIL详解
    Android之Services
    Android之ActivityII
    Android之Activity
    托管执行过程
    Android之Content ProviderII
    Android之Content Providers
  • 原文地址:https://www.cnblogs.com/huichao1314/p/7661255.html
Copyright © 2020-2023  润新知