No mapping exists from object type WebMatrix.Data.DynamicRecord to a knownmanaged provider native ty

No mapping exists from object type WebMatrix.Data.DynamicRecord to a knownmanaged provider native ty,第1张

No mapping exists from object type WebMatrix.Data.DynamicRecord to a knownmanaged provider native ty

Looks like your issue is with your

groupID
input parameter.

var listOfGroups = db.Query("SELECt GroupID FROM Membership WHERe UserID = (SELECt UserID from Users WHERe Username = @0 )",  username);

Your

listOfGroups
is coming back as a collection of the
WebMatrix.Data.DynamicRecord
objects. You seem to want just the
int
value,
as you get
groupID
in the
foreach(var groupID in listOfGroups)
statement.

Try instead replacing the last line:

AND    e.event_end <= @5", groupID, start, end, groupID, start, end

with:

AND    e.event_end <= @5", (int)groupID.GroupID, start, end, (int)groupID.GroupID, start, end

This should pull the value from the first (and only) column of each dynamic
query result, that value being the int group ID that you are after.

EDIT: Corrected value call syntax of DynamicRecord query result.



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5673906.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存