Thread: chapter 16 ??
View Single Post
  #1 (permalink)  
Old March 12th, 2005, 01:10 PM
farsfar2 farsfar2 is offline
Authorized User
Join Date: Mar 2005
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 16 ??

Book: Beginning VB.NET 2nd edition chapter 16 page 647
When I ran the application Binding Simple Controls I got the following error saying" can Not bind to property or column au_lname on datasource" here is part of the code.....
Public Class Form1
    Inherits System.Windows.Forms.Form
    'Declare objects...
    Dim myConnection As OleDbConnection = New OleDbConnection _
    ("provider=Microsoft.jet.oledb.4.0;data source=E:\VB Practice files\BindingExample\PUBS.MDB")
    Dim myAdapter As OleDbDataAdapter = New OleDbDataAdapter( _
    "SELECT authors.au_id, au_lname, au_fname, " & _
    "titles.title_id, title, price " & _
    " FROM authors " & _
    "JOIN titleauthors ON authors.au_id = titleauthor.au_id " & _
    "JOIN titles ON titleauthor.title_id = titles.title_id " & _
    "ORDER BY au_lname, au_fname", myConnection)

    Dim myDS As DataSet
    Dim myDV As DataView
    Dim myCurrencyManager As CurrencyManager

Private Sub BindFields()
        'clear any previous bindings...

        'add new bindings to the dataview object..
        txtLastName.DataBindings.Add("Text", myDV, "au_lname") txtFirstName.DataBindings.Add("Text", myDV, "au_fname")
        txtBookTitle.DataBindings.Add("Text", myDV, "title")
        txtPrice.DataBindings.Add("Text", myDV, "price")

        'display a ready status
        StatusBar1.Text = "Ready"
    End Sub