.NET
  Home arrow .NET arrow Working with ADO.NET
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 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
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? 
.NET

Working with ADO.NET
By: Anand Narayanaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 20
    2005-08-29

    Table of Contents:
  • Working with ADO.NET
  • Connecting to the database
  • Inserting Records
  • Searching Records

  • 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

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    Working with ADO.NET


    (Page 1 of 4 )

    This article, part one of a series, discusses the workings of ADO.NET. With the help of an example application, you will learn to manipulate data in a Microsoft Access database, including how to insert, search, and navigate records.

    ADO.NET is an exciting technology provided by the .NET Framework. Prior to ADO.NET, we used ADO (Active Data Objects) with Visual Studio 6. Even though it performs the required task, developers needed to write long lines of code. With ADO.NET, data access is simpler than ever. The .NET Framework ships with the required namespaces for working with ADO.NET. It also comes with two different sets of providers for OLEDB (MS Access) and SQL Server databases. The syntaxes of both these providers are the same except a few changes to the controls. Once you master the working of any one of the providers, it is easy to port the code to other databases.

    In this article, you will learn about the workings of ADO.NET with the help of a Windows Forms project titled Customer Database Application. The application uses a Microsoft Access database to manipulate data and Visual Basic .NET as the programming language. With the help of this application, you can perform the following tasks:

    • Inserting records
    • Navigating records (previous, next, first and last records)
    • Searching records from the database

    User Interface

    The sample application used for this article consists of two forms. The first form is the core of our application, which will prompt you to enter Name and E-mail. You can add additional fields depending upon your requirements. It also includes the required buttons which will perform the required actions such as addition and record navigation (see figure 1).

    The second form of our application consists of a ComboBox and a TextBox control. It will be populated with all of the names which are in the database. It will perform a search on the database, and the text box will display the relevant e-mail address, which matches the corresponding name in the database (see figure 2).

    You can edit and delete the data using the second form. This can be done only after searching for the appropriate record using the search functionality. I will discuss editing and deleting data in the next part of this article.

    I have developed the sample application using Visual Studio .NET 2003. Hence, I have used the built-in controls for connecting to the database on the first form, which is used for data entry and the traditional coding approach for the search functionality. This will help you to learn about the usage of both techniques for connecting to a database.

    Launch Visual Studio .NET 2003 and create a new Windows Forms project. Design a user interface as shown in the first figure above and supply the required properties as shown in the table given below. You have to connect the form to the required database. For this purpose, you can use the built-in data controls which ship with the .NET Framework. Follow the procedure as shown in the next section to properly connect to the database.

    More .NET Articles
    More By Anand Narayanaswamy


       · I am the author for the article - Working with ADO.NET. I hope you will find this...
       · Hi, how to use Dataset with ADO.Net ? there is any free material is there in...
       · Please checkhttp://msdn.microsoft.com/msdnmag/issues/02/01/data/A google...
       · The iGrep search will help you more than Google or any other search. The iGrep...
     

    .NET ARTICLES

    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries
    - Introducing LINQ to SQL Designer using Visua...
    - Beginning LINQ to SQL Using Visual Studio 20...
    - Coding an AjaxPro.NET Based Search Engine fo...
    - Building an AjaxPro.NET Based Search Engine ...

    Iron Speed




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway