Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP.NET (Non-Forum Related)
 Is ASP.Net Right for this?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Suamere
Starting Member

27 Posts

Posted - 30 December 2004 :  17:11:28  Show Profile  Visit Suamere's Homepage  Send Suamere an AOL message  Send Suamere a Yahoo! Message
Okay, so I want a bit of code taken from a user input and placed in my database:
"Fill in the whole form:
User Name:
Alias:"
And viola, they are taken from the page and added to the database. Then, I want a hidden value in the background to run.. I want it to choose a random number to assign to them. 75% chance it'll chose 1-50. 25% chance it'll chose 51 - 100. Can I do that with code on ASP.Net?

If something goes wrong, find the source of the problem and break it's legs.

dayve
Forum Moderator

USA
5820 Posts

Posted - 30 December 2004 :  18:06:58  Show Profile  Visit dayve's Homepage
yes... but it can also be accomplished using Classic ASP... or any other language for that matter.

Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 30 December 2004 :  18:29:43  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message
This sample code will generate a random number according to your post above.


<%
dim randomNumber
weightedRandomNo()
response.write "Weight - " & randomNumber & "<br>"

function weightedRandomNo ()
	randomize timer
	dim myArray(3)
		weight = int(rnd(1)*3)+1
		myArray(0) = int(rnd(1)*50)+1
		myArray(1) = int(rnd(1)*50)+1
		myArray(2) = int(rnd(1)*50)+1
		myArray(3) = int(rnd(1)*50)+51
	randomNumber = myArray(weight)
end function
%>


and this sample code shows how to insert a row into a database from a form.

http://www.aspwebpro.com/aspscripts/records/insertnew.asp

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

Suamere
Starting Member

27 Posts

Posted - 03 January 2005 :  09:47:48  Show Profile  Visit Suamere's Homepage  Send Suamere an AOL message  Send Suamere a Yahoo! Message
Thanks a poop load. Though that's not really the randoms I needed, your example let me see the code, so I could suit it to my way overly complex random thingie. Thanks.

If something goes wrong, find the source of the problem and break it's legs.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000 Version 3.4.07