อยากทราบลักษณะการทำงานว่าสามารถทำได้ลักษณะไหนบ้าง ผมใช้ C# กับ SQL sever
Tag : - - - -
Date :
2009-03-14 10:23:19
By :
jaotct
View :
1654
Reply :
2
No. 1
Guest
Code (PHP)
' VB.NET
Public Function GetRandomPasswordUsingGUID(ByVal length as Integer) as String
'Get the GUID
Dim guidResult as String = System.Guid.NewGuid().ToString()
'Remove the hyphens
guidResult = guidResult.Replace("-", String.Empty)
'Make sure length is valid
If length <= 0 OrElse length > guidResult.Length Then
Throw New ArgumentException("Length must be between 1 and " & guidResult.Length)
End If
'Return the first length bytes
Return guidResult.Substring(0, length)
End Function
// C#
public string GetRandomPasswordUsingGUID(int length)
{
// Get the GUID
string guidResult = System.Guid.NewGuid().ToString();
// Remove the hyphens
guidResult = guidResult.Replace("-", string.Empty);
// Make sure length is valid
if (length <= 0 || length > guidResult.Length)
throw new ArgumentException("Length must be between 1 and " + guidResult.Length);
// Return the first length bytes
return guidResult.Substring(0, length);
}