error CS1024和error CS1025

来源:互联网 发布:脚本录制软件 编辑:程序博客网 时间:2024/06/04 20:09

今天写代码,写得前台代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AlternateView.aspx.cs" Inherits="AlternateView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="Panel1" runat="server" Height="539px" Width="488px">
            <asp:GridView ID="MyGridView" runat="server" DataKeyNames="CustomerID" DataSourceID="MySqlDS"
                Width="488px" AutoGenerateColumns="False" BorderColor="White" OnRowCommand = "MyGridView_RowCommand">
                <AlternatingRowStyle BackColor = "#C0C0FF" BorderStyle = "Double" />
                <Columns>
                    <asp:BoundField DataField = "CustomerID" HeaderText = "CustomerID" InsertVisible = "False" ReadOnly = "True" SortExpression = "CustomerID"/>
                    <asp:TemplateField HeaderText = "CompanyName">
                        <ItemTemplate>
                            <% #DataBinder.Eval(Container.DataItem,"CompanyName")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField = "ContactName" HeaderText = "ContactName" InsertVisible = "False" ReadOnly = "True" SortExpression = "ContactName"/>
                    <asp:BoundField DataField = "City" HeaderText = "City" InsertVisible = "False" ReadOnly = "True" SortExpression = "City" />
                    <asp:BoundField DataField = "Country" HeaderText = "Country" InsertVisible = "False" ReadOnly = "True" SortExpression = "Country"/>
                    <asp:TemplateField HeaderText = "Operation">
                        <ItemTemplate>
                            <asp:Button ID = "ShowInformation" runat = "server" CommandName = "information" Text = "ShowInfo" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"CustomerID")%>'/>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="MySqlDS" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [City], [Country] FROM [Customers]">
            </asp:SqlDataSource>
            <asp:Label ID="LabelMsg" runat="server" Width="144px"></asp:Label></asp:Panel>
   
    </div>
    </form>
</body>
</html>

后台代码如下:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class AlternateView : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void MyGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.ToLower() == "information")
        {
            //显示信息
            LabelMsg.Text = "CustomerID = " + e.CommandArgument.ToString();
        }
    }
}

结果一直抱错,错误信息如下:

编译错误

说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误信息: CS1024: 应输入预处理器指令

源错误:

 

[没有相关的源行]

源文件:    行: 0


让我抓狂了,找了好久没有找到错误,晕了     


c:/windows/system32/inetsrv> "C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/csc.exe" /t:library /utf8output /R:"C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll" /R:"C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aspnettest(5)/a54bc416/676be9c5/App_GlobalResources.rorasd5u.dll" /R:"C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll" /R:"C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll" /R:"C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll" /R:"C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll" /R:"C:/WINDOWS/assembly/GAC_MSIL/System.Web.Mobile/2.0.0.0__b03f5f7f11d50a3a/System.Web.Mobile.dll" /R:"C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aspnettest(5)/a54bc416/676be9c5/App_global.asax.hznro0vj.dll" /R:"C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll" /R:"C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll" /R:"C:/WINDOWS/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll" /R:"C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll" /out:"C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aspnettest(5)/a54bc416/676be9c5/App_Web_alternateview.aspx.cdcab7d2.qbtr9t-_.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699  "C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aspnettest(5)/a54bc416/676be9c5/App_Web_alternateview.aspx.cdcab7d2.qbtr9t-_.0.cs" "C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aspnettest(5)/a54bc416/676be9c5/App_Web_alternateview.aspx.cdcab7d2.qbtr9t-_.1.cs" "C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/aspnettest(5)/a54bc416/676be9c5/App_Web_alternateview.aspx.cdcab7d2.qbtr9t-_.2.cs"Microsoft (R) Visual C# 2005 编译器 版本 8.00.50727.42用于 Microsoft (R) Windows (R) 2005 Framework 版本 2.0.50727版权所有 (C) Microsoft Corporation 2001-2005。保留所有权利。c:/Inetpub/wwwroot/ASPNETTEST(5)/AlternateView.aspx(20,33): error CS1024: 应输入预处理器指令c:/Inetpub/wwwroot/ASPNETTEST(5)/AlternateView.aspx(20,43): error CS1025: 应输入单行注释或行尾