操作数数据类型 text 对于 subtract 运算符无效。
SqlConnection conn; string sqlstr = "update KuCun set ShuLiang =ShuLiang-'" + TextBox2.Text.ToString().Trim() + "' where cast(BianHao as varchar(55))='" + TextBox1.Text.ToString().Trim() + "' and cast(ChiCun as varchar(55))='" + TextBox3.Text.ToString().Trim() + "'"; string connection = ConfigurationManager.ConnectionStrings["ErpConnectionString"].ConnectionString; conn = new SqlConnection(connection); SqlCommand cmd = new SqlCommand(sqlstr, conn); conn.Open(); cmd.ExecuteNonQuery();