我有一些 ASP.NET 代码要从我的数据库中获取。代码如下:
@{ //begin block
var appDb = Database.Open("apps");
var msg = "hi";
Layout = "~/Header.cshtml";
var queryStr = "SELECT * FROM Apps WHERE appid = '" + @Request.QueryString["id"] + "'";
foreach (var query in appDb.Query(queryStr)) { //begin foreach
<img src="@query.pictureUrl" /><br>
<h2 style="display: inline;"></h2> <h3 style="display: inline;">by </h3>
<p>
</p>
} // end foreach
} // end block
但是,WebMatrix 说 //end foreach 是块的结尾,而不是 foreach 的结尾。它也出现了这个错误:
"}" expected at line
<end of file, i'm only copying the errored block but for me it's line 19>
at column 4
所以我修复了错误,你猜怎么着?它再次出现。再次修复,再次出现等等。
如何修复错误