修改数据库的数据例子

    技术2022-05-11  70

    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(); }}

     

    最新回复(0)