简体   繁体   English

ASP.NET页中的CS1002错误

[英]CS1002 Error in ASP.NET Page

Can anyone help me with this kind of 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: CS1002: ; expected

This seems to cause the error: 这似乎导致错误:

Line 69:                    string code = grdViews.DataKeys[index].Value.ToString();
Line 70:                     
Line 71:                        IEnumerable<DataRow> query = from i in dt.AsEnumerable()where i.Field<String>("Code").Equals(code)select i;
Line 72:                        DataTable detailTable = query.CopyToDataTable<DataRow>();
Line 73:                         DetailsView1.DataSource = detailTable;

This is the sourcecode: 这是源代码:

protected void grdViews_RowCommand(object sender, GridViewCommandEventArgs e)
{
     if(e.CommandName.Equals("detail"))
     {
         int index = Convert.ToInt32(e.CommandArgument);
         string code = grdViews.DataKeys[index].Value.ToString();

         IEnumerable<DataRow> query = from i in dt.AsEnumerable()where i.Field<String>("Code").Equals(code)select i;
         DataTable detailTable = query.CopyToDataTable<DataRow>();
             DetailsView1.DataSource = detailTable;
         DetailsView1.DataBind();
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         sb.Append(@"<script type='text/javascript'>");
         sb.Append("$('#currentdetail').modal('show');");
         sb.Append(@"</script>");
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                               "ModalScript", sb.ToString(), false);
     }
}

The line 线

IEnumerable<DataRow> query = 
    from i in dt.AsEnumerable()where i.Field<String>("Code").Equals(code)select i;

is not valid. 无效。 You need spaces in between the statements, like so: 语句之间需要空格,如下所示:

IEnumerable<DataRow> query = 
    from i in dt.AsEnumerable()
    where i.Field<String>("Code").Equals(code)
    select i;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编译器错误CS1002; 预期的C# - Compiler Error CS1002 ; expected C# 错误 CS1002: ; 预期 - 我有一个分号。 :( - Error CS1002: ; Expected — I have a semicolon. :( 运行时出现错误 CS1002 - Markdown 解析器(仅限标题) - Error CS1002 At Run Time - Markdown Parser (Headers Only) 错误 CS1002: ; 预期和错误 CS1520:方法必须具有返回类型 - error CS1002: ; expected and error CS1520: Method must have a return type 错误CS1002 :; 预期&(31,13):错误CS1525:无效的表达式术语&#39;else&#39; - error CS1002: ; expected & (31,13): error CS1525: Invalid expression term 'else' TFS Build -Error CS1002:; 预期和错误CS1519无效令牌 - TFS Build -Error CS1002: ; expected and Error CS1519 Invalid token unity Assets\\script\\Produce.cs(10,20): 错误 CS1002: ; 预期分辨率 - unity Assets\script\Produce.cs(10,20): error CS1002: ; expected resolution Unity Engine 中 C# 脚本中的 CS1002 和 CS0116 显示错误 - Showing error in CS1002 and CS0116 in C# script in Unity Engine 为什么会收到“编译器错误消息:CS1002:; 预期”错误消息在站点? - Why do I get a “Compiler Error Message: CS1002: ; expected” error message at site? c#来自javascript变量错误的变量分配(CS1002 :;预期) - c # variable assignment from javascript variable error (CS1002:; expected)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM