修改数据库的数据例子

来源:互联网 发布:仙侠学院2 网络电影 编辑:程序博客网 时间:2024/04/24 20:29

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;

using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;


public partial class manage_test : System.Web.UI.Page
{

 protected void Page_Load(object sender, EventArgs e)
 {

  System.DateTime currentTime = System.DateTime.Now;
 
  string cnstr = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  SqlConnection thisConnection = new SqlConnection(cnstr);
  string mysql = "update Tbl_UserRefer set  ReContent='564',ReDate='" + currentTime + "',ReUser_ID=1  WHERE ;
  SqlCommand thisCommand = new SqlCommand(mysql, thisConnection);
  thisCommand.CommandType = CommandType.Text;
  thisCommand.Connection.Open();
  // 执行SQL语句,并返回DataReader对象
  thisCommand.ExecuteNonQuery();
 }
}

 
原创粉丝点击