473,806 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need A Solution!

Suppose an ASP application which retrieves data from a SQL Server
database table is accessed by 100 users. Each of the users have a
password. Assume that the DB table has 25 columns [Column1....Colu mn25]
& the passwords of 3 users are 'A1', 'B2', 'C3' (excluding the quotes).

What the application should do is if the password is 'A1', then that
user should be displayed the records of the columns Column1, Column7,
Column16, Column20 & Column25 only. If the password is 'B2', then that
user should be displayed the records of the columns Column3, Column6,
Column 15 & Column 17. If the password is 'C3', then that user should
be displayed the records of the columns Column2, Column8, Column11,
Column17 & Column23, so on & so forth.

This can be implemented in this way:

----------------------------------------
If(strPassword= "A1") Then
'retrieve Column1, Column7, Column16, Column20 & Column25
ElseIf(strPassw ord="B2") Then
'retrieve Column3, Column6, Column 15 & Column 17
ElseIf(strPassw ord="C3") Then
'retrieve Column2, Column8, Column11, Column17 & Column23
............... .
............... .
............... .
............... .
............... .
End If
----------------------------------------

This means that there will be 100 If....Else statements which obviously
will not only be an inefficient approach but also a highly cumbersome &
tedious one. How can this be implemented more efficiently?

Please note that all the passwords will be stored in a different DB
table.

Somewhat weird, I guess but that's what my client wants!!

Thanks,

Arpan

Sep 3 '05 #1
4 1324
>> How can this be implemented more efficiently?
Probably by normalizing your database, adding user / group tables and
assigning permissions to the users / groups.

Or, you could <barf>create 100 VIEWS for each of the users</barf> and do
your SELECT from the relevant VIEW.

Bob Lehmann

"Arpan" <ar******@hotma il.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Suppose an ASP application which retrieves data from a SQL Server
database table is accessed by 100 users. Each of the users have a
password. Assume that the DB table has 25 columns [Column1....Colu mn25]
& the passwords of 3 users are 'A1', 'B2', 'C3' (excluding the quotes).

What the application should do is if the password is 'A1', then that
user should be displayed the records of the columns Column1, Column7,
Column16, Column20 & Column25 only. If the password is 'B2', then that
user should be displayed the records of the columns Column3, Column6,
Column 15 & Column 17. If the password is 'C3', then that user should
be displayed the records of the columns Column2, Column8, Column11,
Column17 & Column23, so on & so forth.

This can be implemented in this way:

----------------------------------------
If(strPassword= "A1") Then
'retrieve Column1, Column7, Column16, Column20 & Column25
ElseIf(strPassw ord="B2") Then
'retrieve Column3, Column6, Column 15 & Column 17
ElseIf(strPassw ord="C3") Then
'retrieve Column2, Column8, Column11, Column17 & Column23
...............
...............
...............
...............
...............
End If
----------------------------------------

This means that there will be 100 If....Else statements which obviously
will not only be an inefficient approach but also a highly cumbersome &
tedious one. How can this be implemented more efficiently?

Please note that all the passwords will be stored in a different DB
table.

Somewhat weird, I guess but that's what my client wants!!

Thanks,

Arpan

Sep 4 '05 #2
On 3 Sep 2005 16:37:37 -0700, "Arpan" <ar******@hotma il.com> wrote:
Suppose an ASP application which retrieves data from a SQL Server
database table is accessed by 100 users. Each of the users have a
password. Assume that the DB table has 25 columns [Column1....Colu mn25]
& the passwords of 3 users are 'A1', 'B2', 'C3' (excluding the quotes).
You need a lesson in database design. A user is an entity (table). A
password is an attribute (column) of that entity. As would be a
UserName and a UserID (Primary Key). You now have a table with a
UserID, UserName and Password column.
What the application should do is if the password is 'A1', then that
user should be displayed the records of the columns Column1, Column7,
Column16, Column20 & Column25 only. If the password is 'B2', then that
user should be displayed the records of the columns Column3, Column6,
Column 15 & Column 17. If the password is 'C3', then that user should
be displayed the records of the columns Column2, Column8, Column11,
Column17 & Column23, so on & so forth.
Same deal. You can bet each column is an attribute of something,
likely something different. Normalize your database, learn to use
authentication and learn to create an entity relationship diagram.
Your life will be a lot easier.
Please note that all the passwords will be stored in a different DB
table.
Please note that they shouldn't be.
Somewhat weird, I guess but that's what my client wants!!


Clients almost always want a working solution. Almost never would
thay decide on a seriously flawed implementation. If they did, and
forced it on a programmer, I'll bet 99% of programmers would turn down
the job.

Jeff
Sep 4 '05 #3
"Arpan" <ar******@hotma il.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
What the application should do is if the password is 'A1', then that
user should be displayed the records of the columns Column1, Column7,
Column16, Column20 & Column25 only. If the password is 'B2', then that
user should be displayed the records of the columns Column3, Column6,
Column 15 & Column 17.


How about another table that links your "condition" against the columns
that the user should be shown, something like this

Condition Field
A1 1
A1 7
A1 16
A1 20
A1 25
B2 3
B2 6
.... etc. ...

OK, so you have to /retrieve/ the fields for a given "condition" and
/build/ them up into a list that you can use in subsequent SQL, but it
does give you complete flexibility if (or rather, when) the columns
required /change/ over time.

NB: I say "condition" because using a single password to access each
"set" of fields is probably /not/ a good idea - it's amazing how fast
such "restricted " information moves around ... ;-)

HTH,
Phill W.
Sep 5 '05 #4
Thanks Bob, Jeff & Phill for your helpful suggestions.

Regards,

Arpan

Sep 5 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2017
by: Jani Yusef | last post by:
I have a HW problem stated as shown at the top of the solution. The thing is is that I am not 100% sure wtf constant memory means. Well, I think I do but I am confused. Does my solution use contant memory in terms of the length of the list i? If so why not and how could I change it to be so? I am sure the solution is O(n) since the list must only iterated once and the dictionary is O(1), correct? Thanks for the help!! #You are given a...
16
2210
by: Joel Finkel | last post by:
Folks, I am confused as to how to implement the following solution. I have a series of processing steps, each of which contains similar features (forms, etc). Therefore, I create a base class, Step, and subclass from that for specific steps. The Step class has a method, Execute(), which can return either Success or Failure. I have a Step Driver, which instantiates the first Step, calls its Execute()
6
2447
by: SP | last post by:
Hi, I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common solution available that will provide me mechanism to display wait cursor or wait image to user whenever page is post back to server? Thanks,
2
3954
by: moondaddy | last post by:
I'm building a small POS system which I'm going to license out and need to include credit card processing. I've build eCommerce sites before and custom coded CC processing for verisign, but that was coded specific to the clients needs and account with verisign. For this app I need a generic solution where the customer can enter in the parameters for their credit card processor and then be ready for business. I would also want a solution...
20
4113
by: Tony | last post by:
I have a situation where I want to send data, but I have no need for a response. It seems to me that XMLHTTPRequest is the best way to send the data, but I don't need any response back from the server. Basically, I'm writing js errors to an error log on the server side - and there is no need to inform the user that the error has been logged. The problem is that I don't want to sit with the request open & waiting for a response, when I...
23
2561
by: vinod.bhavnani | last post by:
Hello all, I need desperate help Here is the problem: My problem today is with multidimensional arrays. Lets say i have an array A this is a 4 dimensional static array.
1
1745
by: VB Programmer | last post by:
Here's the scenario: 3 different pcs in a doctors office. 2 doctors with 2 seperate appointment calendars. All 3 pcs need to be able to see, real time, both doctors calendars and add, remove, edit appointments. Any suggestions on how to do this? I was thinking of a web based solution where all appointments are kept on 1 pc using outlook. This pc auto-publishes the current calendar regularly to a website. When users add, edit,...
10
2101
by: Frank | last post by:
I've done this a few times. In a solution I have a project, Say P1, and need another project that will contain much code that is similar to that of P1. I hope no one gets hung up on why I don't somehow share the code. So, I copy the folder P1 is in, change the new folder name, and is VS2005 to change all occurrences of P1's name tp P2's name.
25
3144
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of course then the file doesn't get seen by the user. Is there any command that essentially executes the code and then echo's it? something that will take a string like '<body>blah<?php echo 'Hello'; ?></body>' and actually interpret the php
7
1835
by: MZ | last post by:
Hello, I have a webcam connected to the Internet. I can access the current static picture of the camera using an url link. It shows the picture with high resolution 1600x1200. I would like to have a batch program which will do what follows every some amount of time: 1. save the picture automatically on my local computer (which will be always running) 2. lower the resolution of the saved picture
0
10618
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.