473,881 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

not sure how to describe this question...

Hi all,

I'm writing an application in asp .net and vb .net. The question I have
just verifies I need to take an official programming course instead of
this "learning on the fly" stuff :)

Here's the situation. I have a site that people will access from
different site codes (site code = building ID). Each user will have a
profile, and permissions to the system based on the profile. The user
currently can only makes changes to the database for the site
code(building) he/she resides in. I'd like to be able to add the
ability to make a user responsible for several sites. So, for now, I
have an sql database with a site_code column that holds the id of the
site for the user.

The issue I am having is how to manage multiple site codes for a user
when I don't know if he/she will be responsible for 1,2,3,4, or more
sites. Here is what makes sense to me, and I appreciate any input on
this.

I should be able to store the one or more site codes the user has
access to in one database column. Maybe delimited by spaces or commas
or I don't know.

When I load these site codes, should I use some kind of array or
collection? Now we are getting into the asp .net part. I need to store
this information in session so it is available across pages. Eitehr
way, when I get to a routine where I need to check the site codes a
user has permission to, I should be able to do something like:

For each site_code in <something>
'check whatever against the site code and determine what should be
done
Next

Am I making any sense? I am inexperienced with this kind of thing.
Thank you!

Jun 5 '06 #1
10 1261
Why not have a table of sites with a ResponsiblePers on column?

SiteCode | ResponsiblePers on
------------|----------------------
NYNYC |Steven
NYLNG |Steven

Then just do a SELECT to grab them:

SELECT SiteCode FROM Sites WHERE ResponsiblePers on='Steven'

The way you suggested would work, but you'd need to split the site codes
using something like so...

dim Sites() as string
Sites=SiteCodes .Split(",")

Now you'd have an array of strings.

For I as Integer=0 to Sites.Length-1
SiteCode=Sites( I)
'Do somethign with SiteCode
Next
<ma********@gma il.com> wrote in message
news:11******** *************@h 76g2000cwa.goog legroups.com...
Hi all,

I'm writing an application in asp .net and vb .net. The question I have
just verifies I need to take an official programming course instead of
this "learning on the fly" stuff :)

Here's the situation. I have a site that people will access from
different site codes (site code = building ID). Each user will have a
profile, and permissions to the system based on the profile. The user
currently can only makes changes to the database for the site
code(building) he/she resides in. I'd like to be able to add the
ability to make a user responsible for several sites. So, for now, I
have an sql database with a site_code column that holds the id of the
site for the user.

The issue I am having is how to manage multiple site codes for a user
when I don't know if he/she will be responsible for 1,2,3,4, or more
sites. Here is what makes sense to me, and I appreciate any input on
this.

I should be able to store the one or more site codes the user has
access to in one database column. Maybe delimited by spaces or commas
or I don't know.

When I load these site codes, should I use some kind of array or
collection? Now we are getting into the asp .net part. I need to store
this information in session so it is available across pages. Eitehr
way, when I get to a routine where I need to check the site codes a
user has permission to, I should be able to do something like:

For each site_code in <something>
'check whatever against the site code and determine what should be
done
Next

Am I making any sense? I am inexperienced with this kind of thing.
Thank you!

Jun 5 '06 #2
I frequently see people who try to put comma separated data into a
database field. I frequently advice them not to.

Put the information in a separate table, much like Terry Olsen
suggested, only use the id of the site and the person if possible.

If you put all sites for a person in a single field, that field is more
or less useless for database operations. If you for instance want to
list all the persons responsible for different sites, you have to write
a lot of code to look up the information. If you store the information
in a separate table, you just join the tables in a query, and you get
the information fast and simple.
ma********@gmai l.com wrote:
Hi all,

I'm writing an application in asp .net and vb .net. The question I have
just verifies I need to take an official programming course instead of
this "learning on the fly" stuff :)

Here's the situation. I have a site that people will access from
different site codes (site code = building ID). Each user will have a
profile, and permissions to the system based on the profile. The user
currently can only makes changes to the database for the site
code(building) he/she resides in. I'd like to be able to add the
ability to make a user responsible for several sites. So, for now, I
have an sql database with a site_code column that holds the id of the
site for the user.

The issue I am having is how to manage multiple site codes for a user
when I don't know if he/she will be responsible for 1,2,3,4, or more
sites. Here is what makes sense to me, and I appreciate any input on
this.

I should be able to store the one or more site codes the user has
access to in one database column. Maybe delimited by spaces or commas
or I don't know.

When I load these site codes, should I use some kind of array or
collection? Now we are getting into the asp .net part. I need to store
this information in session so it is available across pages. Eitehr
way, when I get to a routine where I need to check the site codes a
user has permission to, I should be able to do something like:

For each site_code in <something>
'check whatever against the site code and determine what should be
done
Next

Am I making any sense? I am inexperienced with this kind of thing.
Thank you!

Jun 5 '06 #3
Good idea but how do you handle multiple persons responsible for multiple
sites? When using delimiters in a table column, I have been able to conduct
searches using the "like" operator.
--
Dennis in Houston
"Göran Andersson" wrote:
I frequently see people who try to put comma separated data into a
database field. I frequently advice them not to.

Put the information in a separate table, much like Terry Olsen
suggested, only use the id of the site and the person if possible.

If you put all sites for a person in a single field, that field is more
or less useless for database operations. If you for instance want to
list all the persons responsible for different sites, you have to write
a lot of code to look up the information. If you store the information
in a separate table, you just join the tables in a query, and you get
the information fast and simple.
ma********@gmai l.com wrote:
Hi all,

I'm writing an application in asp .net and vb .net. The question I have
just verifies I need to take an official programming course instead of
this "learning on the fly" stuff :)

Here's the situation. I have a site that people will access from
different site codes (site code = building ID). Each user will have a
profile, and permissions to the system based on the profile. The user
currently can only makes changes to the database for the site
code(building) he/she resides in. I'd like to be able to add the
ability to make a user responsible for several sites. So, for now, I
have an sql database with a site_code column that holds the id of the
site for the user.

The issue I am having is how to manage multiple site codes for a user
when I don't know if he/she will be responsible for 1,2,3,4, or more
sites. Here is what makes sense to me, and I appreciate any input on
this.

I should be able to store the one or more site codes the user has
access to in one database column. Maybe delimited by spaces or commas
or I don't know.

When I load these site codes, should I use some kind of array or
collection? Now we are getting into the asp .net part. I need to store
this information in session so it is available across pages. Eitehr
way, when I get to a routine where I need to check the site codes a
user has permission to, I should be able to do something like:

For each site_code in <something>
'check whatever against the site code and determine what should be
done
Next

Am I making any sense? I am inexperienced with this kind of thing.
Thank you!

Jun 6 '06 #4
Hello ma********@gmai l.com,
All the other suggestions about database storage are good. A database model
that supports multiple people responsible for multiple entities is a fairly
simple construct.

An aspect that hasnt been addressed is what to do with the data. Newbies
will probably tell you to read the data from the DB on each page load. YUK.
Or they might say read it on the first page load and store the data in session
variable/s. Equally YUK. Look into Forms/Windows Authentication. I can't
remember off the top of my head what the object is, though I think it's Page.Identity.
You populate this at session start.. then you can figure out what the user
is allowed to do by asking Page.identity.I nRole (or IsInRoll ).. anyhow..
you get the idea.

Take care,
-Boo
Hi all,

I'm writing an application in asp .net and vb .net. The question I
have just verifies I need to take an official programming course
instead of this "learning on the fly" stuff :)

Here's the situation. I have a site that people will access from
different site codes (site code = building ID). Each user will have a
profile, and permissions to the system based on the profile. The user
currently can only makes changes to the database for the site
code(building) he/she resides in. I'd like to be able to add the
ability to make a user responsible for several sites. So, for now, I
have an sql database with a site_code column that holds the id of the
site for the user.

The issue I am having is how to manage multiple site codes for a user
when I don't know if he/she will be responsible for 1,2,3,4, or more
sites. Here is what makes sense to me, and I appreciate any input on
this.

I should be able to store the one or more site codes the user has
access to in one database column. Maybe delimited by spaces or commas
or I don't know.

When I load these site codes, should I use some kind of array or
collection? Now we are getting into the asp .net part. I need to store
this information in session so it is available across pages. Eitehr
way, when I get to a routine where I need to check the site codes a
user has permission to, I should be able to do something like:

For each site_code in <something>
'check whatever against the site code and determine what should be
done
Next

Am I making any sense? I am inexperienced with this kind of thing.
Thank you!

Jun 6 '06 #5
Dennis wrote:
Good idea but how do you handle multiple persons responsible for multiple
sites?
Any data that you can put in a comma separated field, you can put in a
separate table, without losing any functionality.
When using delimiters in a table column, I have been able to conduct
searches using the "like" operator.


That only works if no identifier can appear as part of another
identifier. If you for an example search for the id "12", you will also
find any id that contains the combination "12", like "512", "126",
"1128", and so on.
The idea that each field should only contain one piece of information is
nothing new or revolutionary. (It's even older than me. ;)

In normalization it's known as the first normal form. Any relational
database should preferably follow the first, second and third normal
forms. Possibly even the fourth, fifth and sixth normal forms also.

Almost everyone adversed in database design looking at your database
would advise you to normalize it.

http://en.wikipedia.org/wiki/Database_normalization
Jun 6 '06 #6
You all are awesome, and I am dumb. I bow before your greatness... :)
Yes, I should create a new table. I appreciate the response about what
to do with the data afterwards. It seems inefficient to call it from
the database each time, but it is difficult to write a standard routine
to store the data when you don't know how many sites a user is
responsible for.

I have not used the asp.net 2.0 roles yet, but I am familiar with them.
Maybe for each site the user has permission to then I put him in a role
which is titled the name of the site. When validation is performed,
then I check the site code on the form and verify the user is in that
role. Yeah, that's the ticket.

Thanks again. I'd be lost without you all...
Göran Andersson wrote:
Dennis wrote:
Good idea but how do you handle multiple persons responsible for multiple
sites?


Any data that you can put in a comma separated field, you can put in a
separate table, without losing any functionality.
When using delimiters in a table column, I have been able to conduct
searches using the "like" operator.


That only works if no identifier can appear as part of another
identifier. If you for an example search for the id "12", you will also
find any id that contains the combination "12", like "512", "126",
"1128", and so on.
The idea that each field should only contain one piece of information is
nothing new or revolutionary. (It's even older than me. ;)

In normalization it's known as the first normal form. Any relational
database should preferably follow the first, second and third normal
forms. Possibly even the fourth, fifth and sixth normal forms also.

Almost everyone adversed in database design looking at your database
would advise you to normalize it.

http://en.wikipedia.org/wiki/Database_normalization


Jun 6 '06 #7
When I use multiple data in a field, I use special character separators like
%512%612%12% then search for %12% or %512. Not pretty but it works for
simple applications that I write.
--
Dennis in Houston
"Göran Andersson" wrote:
Dennis wrote:
Good idea but how do you handle multiple persons responsible for multiple
sites?


Any data that you can put in a comma separated field, you can put in a
separate table, without losing any functionality.
When using delimiters in a table column, I have been able to conduct
searches using the "like" operator.


That only works if no identifier can appear as part of another
identifier. If you for an example search for the id "12", you will also
find any id that contains the combination "12", like "512", "126",
"1128", and so on.
The idea that each field should only contain one piece of information is
nothing new or revolutionary. (It's even older than me. ;)

In normalization it's known as the first normal form. Any relational
database should preferably follow the first, second and third normal
forms. Possibly even the fourth, fifth and sixth normal forms also.

Almost everyone adversed in database design looking at your database
would advise you to normalize it.

http://en.wikipedia.org/wiki/Database_normalization

Jun 7 '06 #8
Supporting multiple people responsible for multiple in a database may be
simple to you but not to newbie's like myself. Do you have either a
reference to describe some techniques or an example? Thanks.
--
Dennis in Houston
"GhostInAK" wrote:
Hello ma********@gmai l.com,
All the other suggestions about database storage are good. A database model
that supports multiple people responsible for multiple entities is a fairly
simple construct.

An aspect that hasnt been addressed is what to do with the data. Newbies
will probably tell you to read the data from the DB on each page load. YUK.
Or they might say read it on the first page load and store the data in session
variable/s. Equally YUK. Look into Forms/Windows Authentication. I can't
remember off the top of my head what the object is, though I think it's Page.Identity.
You populate this at session start.. then you can figure out what the user
is allowed to do by asking Page.identity.I nRole (or IsInRoll ).. anyhow..
you get the idea.

Take care,
-Boo
Hi all,

I'm writing an application in asp .net and vb .net. The question I
have just verifies I need to take an official programming course
instead of this "learning on the fly" stuff :)

Here's the situation. I have a site that people will access from
different site codes (site code = building ID). Each user will have a
profile, and permissions to the system based on the profile. The user
currently can only makes changes to the database for the site
code(building) he/she resides in. I'd like to be able to add the
ability to make a user responsible for several sites. So, for now, I
have an sql database with a site_code column that holds the id of the
site for the user.

The issue I am having is how to manage multiple site codes for a user
when I don't know if he/she will be responsible for 1,2,3,4, or more
sites. Here is what makes sense to me, and I appreciate any input on
this.

I should be able to store the one or more site codes the user has
access to in one database column. Maybe delimited by spaces or commas
or I don't know.

When I load these site codes, should I use some kind of array or
collection? Now we are getting into the asp .net part. I need to store
this information in session so it is available across pages. Eitehr
way, when I get to a routine where I need to check the site codes a
user has permission to, I should be able to do something like:

For each site_code in <something>
'check whatever against the site code and determine what should be
done
Next

Am I making any sense? I am inexperienced with this kind of thing.
Thank you!


Jun 7 '06 #9
Dennis wrote:
Supporting multiple people responsible for multiple in a database may be
simple to you but not to newbie's like myself. Do you have either a
reference to describe some techniques or an example? Thanks.


Here's an example on how you can store the data:

Persons (PersonId, Name)
1, 'John'
2, 'Peter'
3, 'Audrey'

Sites (SiteId, Name)
1, 'Info'
2, 'Statistics'
3, 'News'
4, 'Economy'

SiteAdmins (SiteId, PersonId)
1, 2
2, 1
3, 1
3, 2
3, 3
4, 3

This gives that:

John is admin for: Statistics and News.
Peter is admin for: Info and News.
Audrey is admin for: News and Economy.

Admins for Info is: John.
Admins for Statistics is: Peter.
Admins for News is: John, Peter and Audrey.
Admins for Economy is: Audrey.
Jun 7 '06 #10

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

Similar topics

0
10234
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the database table, using dynamic sql. Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the error code -2149 is returned That means "Specified partition does not exist". Does anybody know if it is a database problem or a problem of
1
2146
by: mr_burns | last post by:
hi, i am trying to use a function that will write html into empty <span> tags. the <span> tags will all be numbered incrementally and written to using the same function each time. below is my javascript at the top of the page in the <head> part: <head> <script>
1
1589
by: Bruce W.1 | last post by:
I want an XML file to describe hierarchical data where each node is different. Each node will contain different and varied other nodes. Describing this in an XML file would be easy but I'm having a problem with this as related to DTD or XSD. What the XSD really needs to do is describe a node, which can contain other nodes. It could not describe the hierarchy of all the nodes in the XML file. Is it possible to describe a free-form...
2
2372
by: _link98 | last post by:
Environment UDB 8.1 Fixpak 9 on Solaris (64bit instance). After connecting to the database as "my_user". There is an alias from my_user.mytable to XXX.mytable. There is no real table my_user.mytable, only an alias. "select count(*) from mytable" gives correct result for unqualified table name.
4
1223
by: Will | last post by:
Hello all I'm not sure how to word this, which is one reason why I couldn't find anything on Google to help me, so please bear with me as I try to explain myself... I am trying to create a database for a youth club, with relevant info on members, non members, who attended what activity when etc etc. The thing I am trying to do is, each youngster will be in a particular year group in school (i.e. first year, second year etc), I have a...
2
911
by: AndrewW | last post by:
I'm a systems administrator for a company that has in-house programmers. They write applications (using VB) for remote users that enter data out in the filed and transmit this data when they can establish a VPN connection. The mechanism the programmers use (within their code) to transfer files is typically a mapped drive or a unc to an internal Windows server. In my opinion this is probably not the best way to go since netbios stuff needed...
0
1258
by: kirby | last post by:
My db2 environement is as follows: Suse Linux on powerpc, with 64-bit DB2, 8.1 fixpack 8a. Db2 is installed on local drives, and all tablespaces/containers are on some some network attached storage (net appliance I think it is called). The catalog is DMS, and exists on the network attached storage. This configuration is supported by IBM. Net Applicance is one of the supported network attached storage devices. now to the problem....
7
1860
by: Phlip | last post by:
C++ dudes and dudettes: Ogle this code: static char * p; struct Q { char * p; }; static Q q; int main() { assert(p == NULL);
17
78107
abdoelmasry
by: abdoelmasry | last post by:
Hi Men i have real problem using mysql database i make database for my site with mysql it have very important data but i think the database tables corrupted
0
9776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10717
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9552
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7953
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
7109
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
5781
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
5977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4196
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3223
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.