1. Home
  2. Computing & Technology
  3. Visual Basic
Using ADO .NET - Changing Databases - Part 4
4 - The Code and Download
 More of this Feature
• 1 - When Something Has To Change!
• 2 - Selecting Part Of The Database
• 3 - Binding and Changes
 
 Join the Discussion
Is this the kind of article that helps you?
Let us know!
 
 Related Resources
• Part 1 of the ADO .NET Series
• Part 2 of the ADO .NET Series
• Part 3 of the ADO .NET Series
• VB .NET Books!
• New to VB .NET?
  Learn It Here!
 
 Elsewhere on the Web
• About.Com DATABASES
 

Download the code.

Important: You must add the ADO .NET objects using the database in your own environment and bind them to the form components as described in the Part 3 of this series. Database objects are not included in the download. Don't forget to add the bindings in the properties for the TextBox and the ListBox!

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Private Sub Form1_Load( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles MyBase.Load
        ' Selects only Wrox books if Value is "W"; 
        ' only VBA books if Value is "VBA"
        ' This is permitted when the SQL statement 
        ' in the DataAdapter control 
        ' has a WHERE clause: 
        ' WHERE (artTitle LIKE ? + '%')
        Me.OleDbDataAdapter1.SelectCommand.Parameters(0).Value _
             = "VBA"
        Me.OleDbDataAdapter1.Fill(Me.DataSet11)
    End Sub

    Private Sub Button1_Click( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles cmdChangeTitle.Click
        Me.BindingContext(Me.DataSet11, _
             "Articles").EndCurrentEdit()
        Me.OleDbDataAdapter1.Update(Me.DataSet11, "Articles")
        Me.DataSet11.AcceptChanges()
    End Sub
End Class

First page > When Something Has To Change! > Page 1, 2, 3, 4

Explore Visual Basic

More from About.com

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2008 About.com, a part of The New York Times Company.

All rights reserved.