Where do I put my Database relation in DATABASE level or in PROGRAM LEVEL?

M

Mesut Demir

My it's a stup question but :
I'm starting to learn VB.NET. I have some basic skills. I'm from
Mainframe world and I have same question to make my DATABASES (tables
and relation)
I would like to make ask my question by example. Let's say I'm a
sales company I'm selling products to customers. Okay?
I have these tables (databases) and fields and I have these questions.

I have created these tables in VB.NET Database Connections IDE
interface. These 3 files and fields are visually created and I have
also entered some test data.
This is the structure: 1 Customer can have Multiple order, 1
OrderHeader can have Multiple orderDetaillines.
So I only store in OrderHeader the Main things like customer, Order
remark. Everything which is related to product I store it in
OrderDetailTalbe like product, price etc.

MY Intention: I don't want to set my RELEATIONS on DATABASE level,
but in PROGRAM LEVEL, I mean I don't want to visualize to draw a line
from Customer table to Order Header and from Order Header to Order
Detail.........
In Mainframe world we don't put DATABASE relations in DATABASE level,
but in PROGRAM level. ......
My QUESTION: IS this allowed by VB.NET? Can I build an application
like this? Is this a correct way to do? Or do I need to make a Database
Relation DIAGRAM?

WHAT is your idea about it as Experienced VB.NET programmer?

1) CustomerTable
==============
- Customer ID
- Customer Name
- Customer Address
- Customer City
- Customer Country
- Customer Payment term

2) OrderHeaderTable
=================
- Order Number
- Order Type
- Order line
- Customer ID
- OrderRemark
-

3) OrderDetailTable
===============
- Order Number
- Order Type
- Order line
- Customer ID
- Product
- Sales price
- Extented price


Thanks
Mesut
 
O

Otis Mukinfus

My it's a stup question but :
I'm starting to learn VB.NET. I have some basic skills. I'm from
Mainframe world and I have same question to make my DATABASES (tables
and relation)
I would like to make ask my question by example. Let's say I'm a
sales company I'm selling products to customers. Okay?
I have these tables (databases) and fields and I have these questions.

I have created these tables in VB.NET Database Connections IDE
interface. These 3 files and fields are visually created and I have
also entered some test data.
This is the structure: 1 Customer can have Multiple order, 1
OrderHeader can have Multiple orderDetaillines.
So I only store in OrderHeader the Main things like customer, Order
remark. Everything which is related to product I store it in
OrderDetailTalbe like product, price etc.

MY Intention: I don't want to set my RELEATIONS on DATABASE level,
but in PROGRAM LEVEL, I mean I don't want to visualize to draw a line
from Customer table to Order Header and from Order Header to Order
Detail.........
In Mainframe world we don't put DATABASE relations in DATABASE level,
but in PROGRAM level. ......
My QUESTION: IS this allowed by VB.NET? Can I build an application
like this? Is this a correct way to do? Or do I need to make a Database
Relation DIAGRAM?

WHAT is your idea about it as Experienced VB.NET programmer?

1) CustomerTable
==============
- Customer ID
- Customer Name
- Customer Address
- Customer City
- Customer Country
- Customer Payment term

2) OrderHeaderTable
=================
- Order Number
- Order Type
- Order line
- Customer ID
- OrderRemark
-

3) OrderDetailTable
===============
- Order Number
- Order Type
- Order line
- Customer ID
- Product
- Sales price
- Extented price


Thanks
Mesut
You should put the relationship in the database first. It makes for better
handling of the data. You will learn this as you get used to relational DBs.
However, you should also (if using DataSets) put the relationship in the dataset
at the PC, so the code at the PC will also know about the relationship.

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
M

Mesut Demir

Thanks Otis,
So I need to create my Tables and make the relations Primary foreignkey
assignment... okay. This is clear.

Do I need to do the same in DATASET? Is it the same handling (way) as
in Database? Why in Dataset then?

regards,

Mesut
 
L

luxspes

Mesut said:
Thanks Otis,
So I need to create my Tables and make the relations Primary foreignkey
assignment... okay. This is clear.

Do I need to do the same in DATASET? Is it the same handling (way) as
in Database? Why in Dataset then?

The DataSet idea... is that it works as a kind of "relational cache"
disconnected of the database... in that way, you can do manipulations of
the data, with having a connection to the server, and you will want to
have referential integrity in your disconnectable application so that
when you finally commit your changes to the database everything is
consistent...
Of course, it is recommended that you build your application
"defensively" that is why the validation must also be represented in the
database (you should not trust that the client application is handling
the referential integrity correctly, you must check it again at database
level to be sure that your database wont become corrupt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top