我正在尝试编写一个查询来显示当前登录用户拥有的所有记录,但我在将“userid”变量插入字符串时遇到问题?
@{
Layout = "~/_template1.cshtml";
var db = Database.Open("StayInFlorida");
var userid = WebSecurity.CurrentUserId;
var premierproperty = "SELECT PropertyName, PropertyID FROM PropertyInfo WHERE OwnerID='userid'";
}
<h1>Properties - Page coming soon</h1>
@userid
@foreach (var row in db.Query(premierproperty)){
@row.propertyname
}
有任何想法吗?