Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Microsoft Access Connection, Displaying and Updating Multiple Tables

Posted on 2004-09-22
3
Medium Priority
?
142 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 450 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 600 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 450 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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview

971 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