你好,我建了一个数据表,名为shuju ,里面有两个字段 time(datatime型)和shuzhi(int型) ,进行如下的操作:
string information = "Server=localhost;User id=rootassword=111111;Database=test;charset=gbk;";
MySqlConnection con = new MySqlConnection(information);
con.Open();
com.Connection = con;
com.CommandText = " update shuju set time=CONVERT(VARCHAR(17), dateadd(n,-15,GETDATE()),120)+'00' where shuzhi=1";
com.ExecuteNonQuery();
con.Close();