补充一点:操作系统是win2000 advanced server

解决方案 »

  1.   

    请把LYL\MYINS
    换成LYL\\MYIN或者
    string StrCon=@"Server=LYL\MYINS;Database=test;User ID=sa;Password=111;Trusted_Connection=False";
      

  2.   

    这是在前面加个@后的出错信息:
    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: CS1519: Invalid token '(' in class, struct, or interface member declarationSource Error: Line 4:  string StrCon=@"Server=LYL\MYINS;Database=test;User ID=sa;Password=111;Trusted_Connection=False";
    Line 5:  SqlConnection SqlCon=new SqlConnection(StrCon);
    Line 6:  SqlCon.Open();
    Line 7:  </script> Source File: c:\inetpub\wwwroot\lyl\datatest.aspx    Line: 6 这是把LYL\MYINS换成LYL\\MYINS后的出错情况:
    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: CS1519: Invalid token '(' in class, struct, or interface member declarationSource Error: Line 4:  string StrCon="Server=LYL\\MYINS;Database=test;User ID=sa;Password=111;Trusted_Connection=False";
    Line 5:  SqlConnection SqlCon=new SqlConnection(StrCon);
    Line 6:  SqlCon.Open();
    Line 7:  </script> Source File: c:\inetpub\wwwroot\lyl\datatest.aspx    Line: 6
      

  3.   

    Invalid token '(' in class, struct, or interface member declaration===???
    严重迷惑,难道你把它写成全角括号了?
      

  4.   

    <%@Import Namespace="System.Data"%>
    <%@Import Namespace="System.Data.SqlClient"%>
    <script language="c#" runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
    string StrCon=@"Server=LYL\MYINS;Database=test;User      
    ID=sa;Password=111;Trusted_Connection=False";
    SqlConnection SqlCon=new SqlConnection(StrCon);
    SqlCon.Open();
    }
    </script>写成这样试试
      

  5.   

    算了,偶也不知道原因但偶装了.net后就可以了。。