Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 10th, 2005, 06:02 PM
Registered User
Join Date: Feb 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Try it out:Ch 16 Dataset Example


I am going through the book and I am working with a microsoft SQL server 2000.

I get an error when I try to run the DataSet Example but only when I try to use the JOIN command. If I leave that out, it runs fine. What am I doing wrong?:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        objDataAdapter.SelectCommand = New SqlCommand
        objDataAdapter.SelectCommand.Connection = objConnection

        objDataAdapter.SelectCommand.CommandText = "SELECT au_lname, au_fname, 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"

        objDataAdapter.SelectCommand.CommandType = CommandType.Text

        Catch b As SqlException
            Dim errorMessages As String
            Dim i As Integer

            For i = 0 To b.Errors.Count - 1
                errorMessages += "Index #" & i.ToString() & ControlChars.NewLine _
                               & "Message: " & b.Errors(i).Message & ControlChars.NewLine _
                               & "LineNumber: " & b.Errors(i).LineNumber & ControlChars.NewLine _
                               & "Source: " & b.Errors(i).Source & ControlChars.NewLine _
                               & "Procedure: " & b.Errors(i).Procedure & ControlChars.NewLine
            Next i

            Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
            log.Source = "My Application"
            Console.WriteLine("An exception occurred. Please contact your system administrator.")
        End Try

        objDataAdapter.Fill(objDataset, "authors")
        grdAutherTitles.DataSource = objDataset
        grdAutherTitles.DataMember = "authors"

        objDataAdapter = Nothing
        objConnection = Nothing

Reply With Quote
  #2 (permalink)  
Old August 28th, 2009, 07:00 AM
Authorized User
Points: 312, Level: 6
Points: 312, Level: 6 Points: 312, Level: 6 Points: 312, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2006
Location: Orpington, Kent, United Kingdom.
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
Default Leaving 'JOINS' out of SELECT Statement ?

If you have copy of Access, or the Microsoft database generator in VB 2008 ( SQL SERVER or whatever ) try using the design wizard to generate the S.Q.L. then copy and paste it into the program at the appropriate point. Make sure it generates the desired output in the wizard firstly. Sometimes there are slight differences in the syntax of S.Q.L. commands as expected, and that which works e.g. '%' has now replaced '*' as a 'wild-card' character when using the LIKE clause in S.Q.L. Good luck, if anything's not clear, reply to this.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 16 -- compile error w/ components adidaswood BOOK: Beginning ASP.NET 1.0 0 September 22nd, 2004 08:57 PM
Chapter 16, DataSet Example danascmitz VB.NET 2002/2003 Basics 6 January 5th, 2004 05:11 AM
DataSet example, Chapter 16 jtimms BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 13 October 11th, 2003 05:03 PM
Ch 16 driver not found dmswdev JSP Basics 1 June 27th, 2003 05:15 AM

All times are GMT -4. The time now is 12:12 AM.

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