多行SQL语句(MySQL)失败

问题描述:

string cmdText = "SET @tempMax := (SELECT MAX(ID) FROM systemMessages);"; cmdText += "UPDATE systemMessages SET partOne = @part1, partTwo = @part2, date=curdate(), time=curtime() WHERE ID = @tempMax"; // the above statement fails

我执行上述操作:rowsAffected = cmd.ExecuteNonQuery();

I execute the above like this: rowsAffected = cmd.ExecuteNonQuery();

不起作用。怎么做?

InnerException:{"参数'@tempMax'必须定义。"}

InnerException: {"Parameter '@tempMax' must be defined."}

第二种方式我尝试了它:

2nd way I tried it:







你确定SET @tempMax:=是正确的而不是   @tempMax =
Are you sure that SET @tempMax := is correct rather than  @tempMax =