PC Review


Reply
Thread Tools Rate Thread

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

 
 
Andy B
Guest
Posts: n/a
 
      8th Aug 2008
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.


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      8th Aug 2008
On Aug 8, 1:46*pm, "Andy B" <a_bo...@sbcglobal.net> wrote:
> 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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"store random number to improve merge accuracy" in word 2007 ajfish@blueyonder.co.uk Microsoft Word New Users 2 13th Nov 2008 12:17 PM
How to create an "activation code" and store it in sql server 2005 database? Andy B Microsoft VB .NET 5 11th Aug 2008 07:33 AM
VBA code store address with areas separated with "," and I need it sometimes with ";" instead tskogstrom Microsoft Excel Programming 2 17th Jun 2007 04:14 AM
"ASP.NET 2005 custon server control" in "ASP.NET 2003 application" Electric Co. Microsoft ASP .NET 1 10th Oct 2006 03:47 AM
Re: <tr id="MyRow" runat="server"> ... </tr> doesn't appear in server-side code Marina Microsoft ASP .NET 0 21st Jul 2003 03:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:34 AM.