Solved

Microsoft Access Connection, Displaying and Updating Multiple Tables

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

20 Experts available now in Live!

Get 1:1 Help Now