写个类库conn.cs,编译后就很好调用了~

解决方案 »

  1.   

    you can put the connectionstring in the web.config file(between <configuration> and </configuration>):
    <appSettings>
         <add key="ConnectionString" value="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=yourdatabase" />
     </appSettings>in the *.aspx.cs file:
    using System.Data.SqlClient;
    using System.Configuration;
    SqlConnection cn=new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
      

  2.   

    to:  qiuji(忆秋季) ( ) 信誉:104 
       非常感谢...  结贴!`