谁用过他和sql数据库连接的,最好图文并茂,谢谢了

解决方案 »

  1.   

    http://www.cnblogs.com/Terrylee/archive/2006/08/01/Enterprise_Library.html你可以看看这个blog,基本企业库的应用都介绍过了.你可以先关注一下数据访问模块
      

  2.   

    需要设置配置文件。
    <configSections>
        <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
      </configSections>
      <dataConfiguration defaultDatabase="dbName" />
      <connectionStrings>
        <add name="dbName1"
          connectionString="Data Source=.;Initial Catalog=pubs;Persist Security Info=True;User ID=sa;Password=password"
          providerName="System.Data.SqlClient" />
    <add name="dbName2"
          connectionString="Data Source=.;Initial Catalog=pubs;Persist Security Info=True;User ID=sa;Password=password"
          providerName="System.Data.SqlClient" />
      </connectionStrings>
      

  3.   

    写个简单的根据存储过程返回结果集。Database db = DatabaseFactory.CreateDatabase();
    DataSet ds = null;
    try
    {
    ds = db.ExecuteDataSet("存储", "参数1", "参数2", "参数3");//需于存储一致。
    }
    catch (Exception err)
    {
    MessageBox.Show(err.Message);
    return;
    }包括很多不是一两句能说清楚的,最好看看文档。