Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases 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 12th, 2005, 03:06 PM
Registered User
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question of Combining Multipe Related Tables

Hi There!

I have a question of Combining Multipe Related Tables.
Here is the code:

'Private ds As DataSet
Private cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Password="""";User ID=Admin;Data Source=C:\wwwroot\db\universal.mdb;.....)

Private Sub btnFill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFill.Click

        Dim da As New OleDbDataAdapter()
        grd.DataSource = Nothing
        Dim ds As DataSet = New DataSet()

        da.SelectCommand = New OleDbCommand()
        da.SelectCommand.Connection = cn
        da.SelectCommand.CommandType = CommandType.Text
        da.SelectCommand.CommandText = "select * from invoice ; select * from order"

        da.TableMappings.Add("Table", "Invoice")
        da.TableMappings.Add("Table1", "Order")


        'ds.Relations.Add("Invo_order", ds.Tables("invoice").Columns("oid"), ds.Tables("order").Columns("oid"))

        grd.DataSource = ds

    End Sub

I have a error message when I press "Fill" button:

"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"

and point out the code "da.Fill(ds)" cannot run.

Can anybody point out the error of these code, I have no idea of this. Exhausted!!

Thank you!

Similar Threads
Thread Thread Starter Forum Replies Last Post
single submit to related tables forumuser BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 10 December 2nd, 2007 10:29 AM
Synchronising Two Sets of Related Tables Odeh Naber Access 11 May 14th, 2007 06:58 AM
Insert on 2 Related tables question acdsky Classic ASP Databases 1 July 21st, 2004 09:29 PM
Combining tables spraveens Access 2 December 29th, 2003 11:08 AM
SPROC multipe inderts in tables nikosdra SQL Server 2000 1 July 26th, 2003 04:10 PM

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