ASP.NET
  Home arrow ASP.NET arrow Page 4 - Developing ASP.NET 2.0 Applications with t...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Developing ASP.NET 2.0 Applications with the Microsoft Data Access Application Block
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 18
    2006-10-02

    Table of Contents:
  • Developing ASP.NET 2.0 Applications with the Microsoft Data Access Application Block
  • What are Microsoft Enterprise Application Blocks?
  • Developing an ASP.NET application using the Data Access Application Block: adding references
  • Configuring a connection string
  • Developing the code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Developing ASP.NET 2.0 Applications with the Microsoft Data Access Application Block - Configuring a connection string


    (Page 4 of 5 )

    In general, we must embed a database connection string within the "web.config" file belonging to the solution. We will do that here as well, but we do it using the Enterprise Library Configuration.

    Once you have completed all the steps in the previous section, work through the following steps to configure the database connection string using the Enterprise Library Configuration:

    • Within the solution explorer, right click on "web.config" and go to the "open with" option. You will be presented with the "Open With" dialog box.
    • Within the same dialog box, click on "Add" and provide the "Program Name" of "D:Program FilesMicrosoft Enterprise Library January 2006binEntLibConfig.exe" (please modify it according to your installation).
    • Provide a Friendly name of "Enterprise Library Configuration Editor." (Fig 04)


    • Click "OK" twice.  It will automatically open the Enterprise Library Configuration window.
    • If you can already see the Data Access Application Block, you need not create another one.  However, if you don’t see it, you need to create it by simply right clicking on the path and selecting New -> Data Access Application Block.
    • Now, right click on "Connection Strings" and go to New -> Connection String. (Fig 05)


       
    • Provide the name of the connection string, "AdventureWorks." (Fig 06)


    • Provide the name of the database, "AdventureWorks." (Fig 07)


    • Similarly, provide the name of server and integrated security. If you want to use SQL Server security, you can right click on the connection string AdventureWorks, go to new -> connection string parameter and provide any number of other connection string parameters as required.
    • Once the connection string is configured, click on save and close the Enterprise Library Configuration window.

    Once the above steps are completed, you should see something like the following in your web.config file.

      <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>

      <connectionStrings>

        <add name="AdventureWorks" connectionString=
    "AdventureWorks=Database;Server=(local)SQL2k5;Integrated Security=SSPI;"

          providerName="System.Data.SqlClient"/>

      </connectionStrings>

      <appSettings/>  

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hello guys. This is my new series on working with Microsoft Enterprise Library 2.0...
       · hi,Thanks for the article, it helped me a lot.I am using Enterprise Library...
       · Hai,You should never have any problem to get connected to SQL Server 2000 using...
     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT