Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using an array in ASP 3

Status
Not open for further replies.

stlWebWiz

Technical User
Mar 7, 2005
12
0
0
US
Hello,

I'm wondering how I would go about getting info into and out of an array with ASP.

On my form the user can check multiple brands of UPS devices such as APC, ServerTechnology, and MGE.

ABC Software
UPSs
APC
ServerTechnology
MGE

I would want to have APC, ServerTechnology, and MGE stored in an array and then store the array in an access db under the table called UPSs.

I would also want to be able to get this info out of the DB and displayed on a web page.

Can anyone point me in the right direction.
I know it sounds a little fuzzy but its tough to explain right now.

Thanks
SWW
 
Multiple html form elements with the same name will have their values put into a comma separated list in the Request.

Same for a multi-select.

So on the page the processes the form, the value of Request("UPS") might be "APC,ServerTechnolgy,MGE"

You could just write this into a database or convert it to an array using the vbscript Split() function.

If you store it in the database as a comma separated string you can explode it back to an array later when yuo need it using the same function.
 
sheco,

quick questiond if you don't mind? is it right to have comma delimited values in 1 column field? or to create a table called devices and the other ummm..let's say categories...so in the future if he needs like routers...he can put this under categories and put like Cisco 2500 in the devices along w/ the other devices. using a many-tomany relationship ----one category and have many devices and one device can have many categories he could get join the 2 and each record has a unique device and category? bottom line is this....is his way considered "normailized" with multiple values in a field even though it's related to the ups category? just curious because i see alot folks simply store the array in the field instead of 1 value to normaize. I really would like your view on this...thanks!

Brian
 
i know you didn't ask me but i would use multiple tables
 
I think it really depends on what you want to do with the database.

Sometimes a database is just a virtual filing cabinent... a simple data repository.

Sometimes it is part of a powerful tool... for data analysis.

It might be "good form" to always treat your database as the latter, but it is not always the best use of your time.

I guess this is a cop out kinda answer but I'll have to go with "It depends."

Sometimes you really want art... but sometimes you just want to cover that ugly stain on the wall!
 
lol, sorry steven...didn't mean to leave you out...i was surprised you didn't reply here to be honest. i respect your observations as well...you and sheco are obviously highly regarded within this forum and i honestly do learn a lot from you two. only have been doing asp for about 4 months now and looking at what you and sheco have done is quite impressive and i have tons of experience within this time frame and i thank you both. :-}

Brian
 
thanks bslintx for that complement.

But on the subject - i would agree with Sheco that it depends on time, i created an online classes section for a site which used the array method, but on other sites i've done the database method
 
i'm impressed, bslints you have been doing this for only 4 months thats great, i've seen some of your replies to people, your definitely ahead of the game
 
Yeah no kidding! You must already know either regular VB or PHP or something.

Sorry if I sounded bitter about covering the ugly stain...

Its just that I've spent a lot of my career making code art because I wanted to, not because I had to, and I'm not sure I'm any better off because of it.
 
bsl,
here is a little snippet tool i just created a couple days ago of snippets that have help me in the pass, still adding them as i remember more

hope it helps you as you progress.


sorry if the conn isn't the greatest, this is our company's dummy site for displaying test sites
 
Steven,

Please put a comment in the "dynamic variables function" to warn of code injection.

If someone submitted this:
blah:while true:response.write "<BR>what<BR>ever":wend

It would put the server into an infinate loop.

If the asp page happens to run on something under than anonymous, or the IUSR_ account has more privilages, then something much much worse could happen.
 
ah, you'll have to stick a response.flush in there betweent the response.write and the wend or else the looop will hit so hard you wont event get to see the nice scrolling webpage.

like this:
blah:while true:response.write "<BR>what<BR>ever":response.flush:wend
 
thnks guys for the compliments...much appreciated! steven great link...can't wait to dabble...sheco...i concur w/ steven...it's obvious it's made you better....afterall you and steven are tops in helping others out...and what do you BOTH have in common? - efficient and well wriiten code. Kudos - Brian
 
I thought what we had in common was crappy jobs where it is more fun to work on other people's problems...

Hmmm when was the last time I changed my nicotine patch?
 
Thanks for all your input guys, I've got plenty of time to work on this so I think I'm going to go with multiple tables.

STL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top