店铺流程:
CREATE DEFINER=`newdb`@`%` PROCEDURE `GetMaximumIDsCount`(IN AppID INT,IN isBurnCenter INT,IN BurnCenterID INT)
BEGIN
IF isBurnCenter = 1 THEN
SELECT MAX(CAST(b.hospitalid AS SIGNED))
FROM tblhosipital b
WHERE b.appId = AppID AND b.burncenterid IS NULL;
END IF;
IF isBurnCenter = 0 THEN
SELECT MAX(CAST(h.hospitalid AS SIGNED))
FROM tblhosipital h
WHERE h.appId = AppID AND h.burncenterid <> '' AND h.burncenterid = BurnCenterID;
END IF;
END
从 ApplicationDbContext 调用(代码优先)
public virtual ObjectResult<long?> GetMaximumIDsCount2(Nullable<int> appID, Nullable<int> isBurnCenter, Nullable<int> burnCenterID)
{
var appIDParameter = appID.HasValue ?
new ObjectParameter("AppID", appID) :
new ObjectParameter("AppID", typeof(int));
var isBurnCenterParameter = isBurnCenter.HasValue ?
new ObjectParameter("isBurnCenter", isBurnCenter) :
new ObjectParameter("isBurnCenter", typeof(int));
var burnCenterIDParameter = burnCenterID.HasValue ?
new ObjectParameter("BurnCenterID", burnCenterID) :
new ObjectParameter("BurnCenterID", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery<Nullable<long>>("GetMaximumIDsCount @AppID, @isBurnCenter, @BurnCenterID", appIDParameter, isBurnCenterParameter, burnCenterIDParameter);
}
获取异常:
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行的“GetMaximumIDsCount @AppID、@isBurnCenter、@BurnCenterID”附近使用的正确语法
相关分类