ASP.NET
  Home arrow ASP.NET arrow Page 5 - Binding Data to Controls with MS Access an...
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

Binding Data to Controls with MS Access and ADO
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2006-06-14

    Table of Contents:
  • Binding Data to Controls with MS Access and ADO
  • Retrieving and displaying data using text boxes
  • Code to retrieve the recordset
  • Populating a combo box
  • Displaying the combo box
  • Displaying a list box

  • 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


    Binding Data to Controls with MS Access and ADO - Displaying the combo box


    (Page 5 of 6 )

    When the form is displayed the combo box will be empty, but when the "Populate Combobox" button is clicked, the combo box will be filled with the names of the shippers in the database as shown. For the purposes of this display, the form's record navigator, separator and record related properties have been set to false.

    Filling a list box

    For read-only decision support data display purposes, the list box is ideal. It is very efficient in terms of resources, and it is easy to add functionality to arrange for drill-down of data -- more refined filtering of the data. Similar to the combo box, in this demo tutorial, add a list box and a button. For the click event of the button, type in this code.

    Private Sub Command11_Click()
    Me.List12.RowSource = ""
    '-----fast data retrieval block----
    With cnn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .Open "C:Program FilesMicrosoft OfficeOFFICE11SAMPLESNorthwind.mdb"
    End With
    strsql = "Select * from Shippers"
    With rst
    Set .ActiveConnection = cnn
    .CursorType = adOpenForwardOnly
    .LockType = adLockReadOnly
    .Open strsql
    End With
    '-----------------------
    Dim strlist
    strlist = ""
    rst.MoveFirst
    While Not rst.EOF
    '---------create value list
    strlist = strlist & rst.Fields.Item(1) + "--" + rst.Fields.Item(2) & ";"
    rst.MoveNext
    Wend
    MsgBox strlist
    Me!List12.RowSource = strlist
    Set rst = Nothing
    Set cnn = Nothing
    End Sub
    

    The design view of the list box control is shown. The list will be filled when the "Populate the List Box" button is clicked. It is necessary that the Row source type property be set to value list at design time for the list box.

    More ASP.NET Articles
    More By Jayaram Krishnaswamy


       · The predominance of Microsoft products, especially its Office is primarily because...
     

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - 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

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




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