Wrox Programmer Forums
|
BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2005, 01:00 PM
Authorized User
 
Join Date: Mar 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default database connection problem

I am running the example in Beginning VB.NET 2nd edition on Binding simple controls (page 650) but when I run the application, I am getting the following error saying " can not bind to property or column au_lname on datasource"

Private Sub BindFields()
        'clear any previous bindings...
        txtLastName.DataBindings.Clear()
        txtFirstName.DataBindings.Clear()
        txtBookTitle.DataBindings.Clear()
        txtPrice.DataBindings.Clear()

        '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
thanks
 
Old March 14th, 2005, 06:52 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I ran the code from the book and didn't have any problems. Check your SQL statement in the FillDataSetAndView procedure and ensure it looks similiar to this with the correct column names:

        'Initialize a new instance of the OleDbDataAdapter object
        objDataAdapter = New OleDbDataAdapter( _
            "SELECT authors.au_id, au_lname, au_fname, titles.title_id, " & _
            "title, price " & _
            "FROM authors " & _
            "JOIN titleauthor ON authors.au_id = titleauthor.au_id " & _
            "JOIN titles ON titleauthor.title_id = titles.title_id " & _
            "ORDER BY au_lname, au_fname", objConnection)

Thearon





Similar Threads
Thread Thread Starter Forum Replies Last Post
[?] A database connection problem Aritra ASP.NET 1.0 and 1.1 Basics 3 August 26th, 2008 02:19 AM
Database Connection Problem vinyl-junkie Classic ASP Databases 2 June 2nd, 2008 03:18 AM
Database Connection Problem murali_vijaya JSP Basics 1 August 5th, 2006 10:10 AM
access database connection problem shaileshk ADO.NET 6 July 5th, 2005 03:30 AM
Database Connection Problem Wolfgang_nl Crystal Reports 0 July 19th, 2004 01:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.