Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi!

 

I will write an application that work with an Access DB.

My database have 5 table that have a relationship to each other.

 

tables in DB:

 

Table 1: Car: CarID, Manufactore, Colour, Hp, Displacement, Price, Model

Table 2: SaleContractCar: SaleContractID, CarID

Table 3: SaleContract: SaleContractID, CustomerID, Date

Table 4: Customer: CustomerID, CustomerAddressID, Tel, Age, SeconCar, Name

Table 5: CustomerAddress: CustomerAddressID, Street, StreetNr, Zip, City

 

relationship between the tables:

 

Table 1 (one to more) Table 2

Table 2 (more to one) Table 3

Table 3 (more to one) Table 4

Table 4 (more to one) Table 5

 

 

at this moment I don't know how to start.

 

should I first load all tables I one DataSet?

and create for each table a DataTable?

 

how I should start?

how I should write an update SQL statement for this DataSet?

 

where I can find some sample application that work with Relational Data?

 

 

thx!!

  • Leaders
Posted

I think I'd use the wizard in VS.NET to create a typed dataset with all the tables in it for now. I wouldn't actually use this, but it'll give a good idea of where to go from there. This page has a tutorial on Data and ADO.NET -> Working with Relational Data that should prove useful.

http://samples.gotdotnet.com/quickstart/howto/

 

I guess the jury is still out on how exactly people are using datasets in their apps and what the best practices are but I'm starting to not use typed datasets and doing more of a pseudo-typed dataset, similiar to Duwamish. Of course this involves manually maintaining them but it's worked well so far without the bloat of typed datasets. This allows you to only build the datatables you need at any given time too.

--tim
  • Leaders
Posted

Sure. This is especially easy if your database contains only one table;)

 

On a serious note, I can't imagine why you'd want to do that. I don't know if there's a quick way to do it either, but I doubt it. I'll look closer if you have a convincing reason why you'd want to do it.:)

--tim
  • *Experts*
Posted

I know you can do this in SQL Server with no problem. When you create your DataAdapter's sql string, you just put in multiple SELECT statements or use a proc that has multiple SELECT statements. I'm not sure if Access will allow this or not, but I think it will. I'd give it a try - start with two tables and separate each SELECT with a semicolon (I think that's what Access uses).

 

SELECT CarID, Manufactore, Colour, Hp, Displacement, Price, Mode FROM Car; SELECT SaleContractID, CarID FROM SaleContractCar

 

Let me know if this doesn't work - I don't have Access installed right now, but I can get it on pretty quick.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...