strConnect = @"Provider=Microsoft.Jet.OLEDB.4.0 Data Source=C:\rogram Files\Microsoft.NET";
如果不使用@,则其中的"\"字符是转义字符
比如\n被认为是换行而不是路径分隔加n

解决方案 »

  1.   

    取消特殊字符转译这里是限制\等同于
    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=C:\rogram Files\\Microsoft.NET";
      

  2.   

    To specify a String literal,you can use one of two forms-quoted and @-quoted(also known as a "verbarim string").A quoted string literal is enclosed in double quotes(") and can use the normal c-style escape sequence for newline(\n),tab(\t),and so on.The @-quoted string literal is similar to the quate style except escape sequence are not processed.This makes the @-quoted literal very convenient for processing pathnames.For example:
    //quoted string literals
    String s="Hello World";String p="C;\\winnt\\system32";
    //note the \\ that is interpreted as b literal backslash//@-quoted string literals
    String path=@"c:\winnt\system32";
    //note that escape sequences are not processed