Solved

Microsoft Access Connection, Displaying and Updating Multiple Tables

Posted on 2004-09-22
3
135 Views
Last Modified: 2010-04-23
I'm working on a senior project for a college class.  Instead of doing my senior project on something I knew, I chose to use something I've never done before (.net).  Basically I've chosen to do a simple order system using vb.net and access.  I'm looking for a simple way to display and update data from 3 tables in one datagrid  (actually, any object will do at this point).  Really, I'm completely lost on this, also I'm very new .net and only have limited experiance using vb6, so detailed instructions would be greatly appreciated.  I can send the solution file I have done so far if you'd like to see exactly what the hell it is i'm trying to do, just let me know at hanson_n@bellsouth.net.
0
Comment
Question by:thetawho
3 Comments
 
LVL 7

Assisted Solution

by:J_Mak
J_Mak earned 150 total points
ID: 12129896
The following links are great for VB .NET and ADO .NET beginners. It was for me! I hope it will be for you as well. The best way to do it is to do everything step by step which I did. I was tempted for quick solutions, but I was able to convince myself to learn and haven't looked back since. So try them :-)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp
http://visualbasic.about.com/library/weekly/aa050303a.htm
http://www.dotnetspider.com/Technology/Tutorials/DatabaseAccess.aspx

I hope that helps!!
0
 
LVL 2

Accepted Solution

by:
ahmadfuwad earned 200 total points
ID: 12130297
'write following code for displaying data into a grid from a 3 Access tables

cn.ConnectionString = "Server=eteam08;Database=dbTestGrid;user id=sa;password=imran"
        cn.Open()
             cmd1.Connection = cn
        cmd1.CommandType = CommandType.Text
        cmd1.CommandText = "select * from tblCustomer"
        oda1.SelectCommand = cmd1
        oda1.Fill(ods, "Customer")

        cmd2.Connection = cn
        cmd2.CommandType = CommandType.Text
        cmd2.CommandText = "select * from tblOrder"
        oda2.SelectCommand = cmd2
        oda2.Fill(ods, "order")

        cmd3.Connection = cn
        cmd3.CommandType = CommandType.Text
        cmd3.CommandText = "select * from tblPackage"
        oda3.SelectCommand = cmd3
        oda3.Fill(ods, "Package")

        ods.Relations.Add("Cstomers", ods.Tables("Customer").Columns(2), ods.Tables("order").Columns(1)) 'coiumns(2) is primary key and column(1) is forign key
        ods.Relations.Add("Customers", ods.Tables("order").Columns(0), ods.Tables("Package").Columns(1)) 'column(0) is primary key and column(1) is forign key

        UltraGrid1.DataSource = ods

'for update go to the relational diagram and make a relation and checked the properties
'cascade update and cascade delete and then write a following code for update


        Try
            Dim oCommandBuilder As New SqlCommandBuilder(oda1)

            oda1.Update(ods, "Customer")

        Catch exp As Exception
            MsgBox(exp.Message)
        End Try
        ods.Relations.Clear()
        ods.Clear()

        cmd1.Connection = cn
        cmd1.CommandType = CommandType.Text
        cmd1.CommandText = "select * from tblCustomer"
        oda1.SelectCommand = cmd1
        oda1.Fill(ods, "Customer")

        cmd2.Connection = cn
        cmd2.CommandType = CommandType.Text
        cmd2.CommandText = "select * from tblOrder"
        oda2.SelectCommand = cmd2
        oda2.Fill(ods, "order")

        cmd3.Connection = cn
        cmd3.CommandType = CommandType.Text
        cmd3.CommandText = "select * from tblPackage"
        oda3.SelectCommand = cmd3
        oda3.Fill(ods, "Package")

        ods.Relations.Add("Cstomers", ods.Tables("Customer").Columns(2), ods.Tables("order").Columns(1))
        ods.Relations.Add("Customers", ods.Tables("order").Columns(0), ods.Tables("Package").Columns(1))

        UltraGrid1.DataSource = ods
0
 
LVL 27

Assisted Solution

by:planocz
planocz earned 150 total points
ID: 12132288
Hi,

Here is where I found good examples for getting started in VB.Net

.....http://msdn.microsoft.com/vbasic/downloads/samples/101samples.aspx

Link for ASP programs...

http://msdn.microsoft.com/asp.net/downloads/kits/default.aspx 

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with solving error related to resources file 4 45
Advice in Xamarin 21 78
Get Client IP on RDS - VB.NET 15 44
Show/Hide ASP.NET controls with JQuery best practices 3 45
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now