ADO.NET Driver for Mysql是不是有bug 为何这么写老是报没有定义@EndDate的错误
Mysql的参数是不需要定义的,直接用就行了
代码如下,请高手看看
public void CreateSnapshot(string dateConfigID)
{
//这么写老是报语法错误
string sql = @"SELECT @EndDate:=EndDate FROM dateconfig WHERE ID=@ConfigID;
UPDATE department
SET DateConfigID =@ConfigID,
SnapshotDate = @EndDate
WHERE
DateConfigID = '-99' AND DeptCode NOT in(
SELECT T.DeptCode FROM(
SELECT DeptCode FROM department a WHERE a.DateConfigID=@ConfigID
) T);
var param = new DynamicParameters();
//param.Add("EndDate", DateTime.MinValue);
param.Add("ConfigID", dateConfigID);
OpenConnection(conn =>
{
conn.Execute(sql, param);
});
}