Solved

Microsoft Access Connection, Displaying and Updating Multiple Tables

Posted on 2004-09-22
3
140 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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