Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
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 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 January 20th, 2005, 03:48 PM
Authorized User
 
Join Date: Jan 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error - Cannot create a child list

I am getting 2 error with the code below. First error is "Syntax error in From Clause". Second error is "Cannot create a child list for field Received". Please help......Thanks

Imports System.Data
Imports System.Data.OleDb

Public Class rptReport
    Inherits System.Windows.Forms.Form

    Private Sub rptReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myConnection As OleDbConnection = New _
                OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=G:\IDC\Received Dispensed Deleted.mdb;User Id=admin;Password=;")
        Dim myDataAdapter As New OleDbDataAdapter
        Dim myDataSet As DataSet = New DataSet
        'Set the SelectCommand properties...
        myDataAdapter.SelectCommand = New OleDbCommand
        myDataAdapter.SelectCommand.Connection = myConnection
        myDataAdapter.SelectCommand.CommandText = "SELECT ReceivedDrug, Dispensed, Destroyed " & _
        "FROM Received " & _
        "JOIN Dispensed ON Received.ReceivedDrug = Dispensed.Dispensed " & _
        "JOIN Destroyed ON Received.ReceivedDrug = Destroyed.Destroyed " & _
        "ORDER BY ReceivedDrug"
        myDataAdapter.SelectCommand.CommandType = CommandType.Text

        myConnection.Open()
        Try
            myDataAdapter.SelectCommand.ExecuteNonQuery()
            'Fill the DataSet object with data
            myDataAdapter.Fill(myDataSet, "Received")
        Catch err As OleDbException
            MessageBox.Show(err.Message)
        Finally
            myConnection.Close()
        End Try
        'set the DataGrid properties to bind it to our data.....
        grdReport.DataSource = myDataSet
        grdReport.DataMember = "Received"
    End Sub


End Class
 
Old January 20th, 2005, 04:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

since you are using access, try to paste the query on it to get a better error about it...

access use inner join instead of join..

i cannot tell you anything about the second error.

HTH

Gonzalo





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a list box containing available printers Grimgore VB How-To 1 October 29th, 2008 01:56 AM
Create a drop down list using database values erinrox JSP Basics 1 September 4th, 2007 06:59 AM
Create a Collapsible List AnithaReddyKora ASP.NET 2.0 Basics 0 December 13th, 2005 06:40 AM
Howto create Distribution list Alcapone C# 1 November 1st, 2004 06:25 AM
Create list of logical drives in combobox bcmaverik VB.NET 2002/2003 Basics 1 February 7th, 2004 02:31 PM





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