Fatal error encountered during command execution

MySQL + .net + EF 開發環境,調用一處sql語句報錯:mysql

Fatal error encountered during command execution
[sql] view plain copy print?
SELECT @r AS cateid,(SELECT @r := b.ParentId FROM cmscontentcategory b WHERE b.id = cateid) AS parentid
FROM (SELECT @r := '75422ccd151c484291013d72f9a98cd7') vars,cmscontentcategory h
WHERE @r <> 'sys';
查看詳細錯誤:
Parameter '@r' must be defined
查看國外資料發現一個方法,在mysql數據鏈接字符串增長Allow User Variables=Truesql

Database=testdb;Data Source=localhost;User Id=root;Password=hello;Allow User Variables=True.net

ok,搞定。3d

相關文章
相關標籤/搜索