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 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.
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