Datebase Design

Results 1 to 2 of 2

Thread: Datebase Design

  1. #1
    Join Date
    Dec 1969

    Default Datebase Design

    Bill. Thank for the help yesterday I was able to get my code running. I had to add in a line that Removed all the spaces from my comma-delimeted line before it was written to the database because for some reason my code was adding them in 1, 2, 3 instead of 1,2,3 but it works great now.<BR><BR>You mentioned that having a list of values like that however was bad data base design.<BR><BR>Basically what my code does is compare that list of values 1,2,3 etc to a session id which is the current user. Thus decieding if the current record should be displayed or if it should move on. This allows me to display one record to a variable number of users.<BR><BR>How should I redesign.. What would be a good design to accomplish this task?<BR><BR>Thanks<BR>Ian

  2. #2
    Join Date
    Dec 1969

    Default Interesting usage...

    You must not have very many users, yes? If you had 10,000 users I guarantee you&#039;d be thinking of other ways to do this!<BR><BR>Anyway, the right way would be something like this:<BR><BR>TABLE: Users<BR> userID : PK, autonumber<BR> userName : text<BR> ... etc. ...<BR><BR>TABLE: Info<BR> infoID : PK, autonumber<BR> infoDescription : text<BR> ... etc. ...<BR><BR>TABLE: InfoAllowed<BR> infoID : foreign key to Info table<BR> userID : foreign key to Users table<BR><BR>And then you&#039;d do something like:<BR><BR>&#060;%<BR>SQL = "SELECT Info.* FROM Info, InfoAllowed " _<BR> & " WHERE Info.infoID = InfoAllowed.infoID " _<BR> & " AND Info.userID = " & Session("userID")<BR>Set RS = conn.Execute( SQL )<BR>Do Until RS.EOF<BR> ... now you show *all* records, unconditionally...<BR> RS.MoveNext<BR>Loop<BR>%&#062;<BR><BR>In a larger organization, you&#039;d probably have yet another "PermissionsKind" table which would specify the *kinds* of permissions needed per Info record and then Users would receive zero or more "kinds" of permission instead of direct permission to individual records.<BR><BR>p.s.: Too bad you bothered to remove all the spaces...there was an easy way to use them, as is.<BR><BR>

Posting Permissions

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