using Microsoft.Practices.EnterpriseLibrary.Data;

                DatabaseFactory.ClearDatabaseProviderFactory();
                DatabaseFactory.SetDatabaseProviderFactory(new DatabaseProviderFactory(), true);

Database db = DatabaseFactory.CreateDatabase();
                DbCommand dbCommand = db.GetStoredProcCommand(DBConstantNames.GET_PROJECT_SP);
                dbCommand.CommandTimeout = 1800; //30 min
                dbCommand.Parameters.Add(new SqlParameter("@ProjectName", strProjectName));
                dbCommand.Parameters.Add(new SqlParameter("@InterfaceName", strInterfaceName));

 DataSet ds = db.ExecuteDataSet(dbCommand);

// db.ExecuteNonQuery(dbCommand);
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=6.0.0.0, Culture=neutral" />
  </configSections>

<dataConfiguration defaultDatabase="DB1ConnectionString" />

  <connectionStrings>
    <add name="DB1ConnectionString" connectionString="Database=Database01;Server=localhost;UID=user01;PWD=pw01;Min Pool Size=1;Max Pool Size=100;Connect Timeout=120;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
Last modified: June 26, 2019

Author

Comments

Write a Reply or Comment