Solved

Microsoft Access Connection, Displaying and Updating Multiple Tables

Posted on 2004-09-22
3
136 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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