CS1026: ) expected
问题不说啦,这段代码(和)刚刚好数量,为什么他会说:CS1026: ) expected
<a href='show.aspx?W_id=<%# Eval("W_id") %>' target="_blank" title='header=[<span class="specialTextRight"><%# Eval("W_Width") %>x<%# Eval("W_Height") %><br /><%# Eval("W_size") %> KB</span><b><%# Eval("W_title") %></b> <br /><span class="text2">Artist: </span><%# Eval("W_Artist") %><br /><span class="text2">Description: </span><%# Eval("W_Description") %><br /><span class="text2">Tags: </span><%# Eval("W_tag") %><br /><span class="specialTextRight"><%# Eval("W_date") %></span><span class="text2">Uploader: <%# _987bz.Data.DbHelper.ExecuteScalar("SELECT U_name FROM [User] WHERE (U_id = " + Eval("W_uploader") + ")"); %></span><br /><span class="specialTextRight"><%# Eval("W_view") %> views</span><%# _987bz.Data.DbHelper.ExecuteScalar("SELECT C1_name FROM Cat1 WHERE (C1_id = " + Eval("W_C1id") + ")"); %> <span class="text3">></span> <%# _987bz.Data.DbHelper.ExecuteScalar("SELECT C2_name FROM Cat2 WHERE (C2_id = " + Eval("W_C2id") + ")"); %>] body=[ ] fade=[off]' >
Server Error in '/' Application.
--------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1026: ) expected
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
------解决方案--------------------<%# _987bz.Data.DbHelper.ExecuteScalar("SELECT C2_name FROM Cat2 WHERE (C2_id = " + Eval("W_C2id") + ")"); %>
你是执行服务器脚本,不要#
改成
<% _987bz.Data.DbHelper.ExecuteScalar("SELECT C2_name FROM Cat2 WHERE (C2_id = " + Eval("W_C2id") + ")"); %>
你有好几个地方一一改了就OK了
------解决方案--------------------对不要用#
------解决方案--------------------关键是最后那个分号,数据绑定的时候不能加分号的
target.SetDataBoundString(9, System.Convert.ToString(_987bz.Data.DbHelper.ExecuteScalar("SELECT U_name FROM [User] WHERE (U_id = " + Eval("W_uploader") + ")");, System.Globalization.CultureInfo.CurrentCulture))
这个是生成的C#代码,可以看出为什么会出那个错误了