473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Create a random "activation code" and store it in sql server 2005

I am making a web application that would randomly create an activation code
and put it in a database. The web application would then send it in an email
to the user with a link to go to and enter the activation code. How would I
do this? and what sql server data type would I use? I want the activation
code to be no longer than 12 characters, have a mix of numbers and letters
and have no special symbols.
Aug 8 '08 #1
1 2227
On Aug 8, 1:46*pm, "Andy B" <a_bo...@sbcglobal.netwrote:
I am making a web application that would randomly create an activation code
and put it in a database. The web application would then send it in an email
to the user with a link to go to and enter the activation code. How wouldI
do this? and what sql server data type would I use? I want the activation
code to be no longer than 12 characters, have a mix of numbers and letters
and have no special symbols.
If you want to create it in the code then you can use
System.Guid.NewGuid(). It creates a string like a55954b3-
f858-4f83-82a9-38422b10168d

http://msdn.microsoft.com/en-us/libr...d.newguid.aspx

For example,

string key = System.Guid.NewGuid().ToString().Replace("-",
string.Empty).Substring(0, 12);

or you can create an own function, or you can create a function in sql
Aug 8 '08 #2

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

Similar topics

5
by: apple | last post by:
UDBV8 fp 6a - AIX 5.1 We have scheduled cron jobs to do backups. Periodically and starting to occur more frequently, a backup fails with this error: SQL2072N Unable to bind the shared library...
30
by: (Pete Cresswell) | last post by:
Just fired it up to see what it looked like. They wanted me to "Activate" the product before the 50th use. Geeze, I paid my money....now they want me to jump through their hoops? Brings back...
2
by: mike_li | last post by:
On Window 2000 Professional Server DB2 UDB Level: DB2 code release "SQL07029" with level identifie "030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and "WR21337". In the...
1
by: Rudolf Bargholz | last post by:
Hi, We have created triggers to log modifications to tables in our application. The triggers work fine, just on one of the tables in our database the triggers fail with the error message...
5
by: Andy B | last post by:
I am making a web application that would randomly create an activation code and put it in a database. The web application would then send it in an email to the user with a link to go to and enter...
2
by: readnlearn | last post by:
hii i hav a problem with thsi code check it once if (!this.IsPostBack) // Create a random code and store it in the Session object. this.Session = GenerateRandomCode(); else
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...

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.