1、在web.config中的连接字符串。
<add name="PMSConnectionString" connectionString="Data Source=JIUGE-SERVER;Initial Catalog=PMS;Persist Security Info=True;User ID=PMS;Password=qz61etj" providerName="System.Data.SqlClient"/>
   问题:  如何把他取到程序中,他的providerName是做什么用的。2、新建一个class,如何在其他文件中引用它。

解决方案 »

  1.   

    1providerName是指数据库的类型
    2 添加System.Configuration.dll 
    using System.Configuration调用 ConfigurationManager.AppSettings["PMSConnectionString"].ToString();
      

  2.   

    1:
    说明provider的种类,比如sql server是System.Data.SqlClient
    oracle是System.Data.OleDb
    2:很多了
    比如有个footer类,在后台文件里面:
    public partial class footer : System.Web.UI.Page
    {--------------}
      

  3.   

    更正1 providerName是指数据库连接方式名称
      

  4.   

    SqlDataSource1 = new SqlDataSource();
            SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["SubjectConStr"].ToString();
            SqlDataSource1.ProviderName = "System.Data.SqlClient";//此句
            SqlDataSource1.SelectCommand = "select * from SubjectTable";