Results 1 to 5 of 5

Thread: Database Relations OR Via Code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    17

    Question Database Relations OR Via Code

    HI

    I am working on a Accounts and Inventory Project for a Workgroup. Now, What I did is that I do not define any relation between the tables. I am managing it through code. For exmaple , In the Invoic Form, the user opens the form, it automatically to to the first record of mater, then I filter the detail table and display the reords in Grid having the same invoice number as master.

    Similarly I handled all the cases of edit, delete, add, navigation, etc.

    I want to know what are the disadvantages of WORKING WITH THE ABOVE APPROACH ? and Wha are the Advantages of defining tables relation in database ????

    Thanks a million in Advance.
    Thanks & Regards

    Zeeshan Hashmi

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    The overall goals is to package as much of the "business" logic as far away from the client as possible.

    The fact that you manage the invoice and detail data in the client, to give a proper view of data to the user is fine - that's great.

    But not having referential-integerity in the DB to force this is not good - that means you client code is "enforcing" more than it should.

    If a weak user writes a query to update and doesn't know about the rules in your VB code, then a DB failure is what happens next. You want a poor QUERY to fail in the database, so the user is forced to make it proper...

    Just my opinion...
    Last edited by szlamany; Aug 23rd, 2004 at 07:39 AM.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    17

    Reply

    Hi, thanks for the reply.


    The thing is that the user can not enter QUERIES himself. He is limited to perform day to day data manipulations like ADD,DEL, Edit, Reports etc. As far as the reports are concerned, there are a lot of queries predifinied, so again the user has to SELECT which report he wants to see.

    so , if this is the case , then is it necessary to implement Database Relation rulesss ?
    Thanks & Regards

    Zeeshan Hashmi

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Even though the users cannot enter queries....they still enter the data. Having the relations in the DB help to enforce data integrity will help to ensure bad data doesn't get in. It will also help the DB optimize queries for efficientcy.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    My opinion is this:

    You design the db and you allow the users to enter data.
    If you allow them access to the tables/queries or write their own queries, you should expect the db to fail.

    As to referential integrity, if your code is working fine it won't matter (see above point on users n queries). So you won't have to worry about crap data getting in 'cause you've coded for it (or you'd better have ).

    Referential integrity is good in principle but overall to the coder its a pain in the ass (again my opinion). Just when you decide its acceptable to delete something, it errors and kills your process in the middle or some other such problem.


    If you have the time, do both ways as it will give you experience in all options available to you.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width