Introduction
This code generates Globally Unique Identifier (GUID),which can be used to uniqually identify elements in a database.
GUIDs identify objects such as interfaces and class objects. A GUID consists of one group of 8 hexadecimal digits,followed by three groups of 4 hexadecimal digits each,which are followed by one group of 12 hexadecimal digits.
Possessing a unique identifier makes it easy to store and retrieve information. This is especially useful when working with a database because a GUID makes an excellent primary key.
SQL Server integrates well with GUID usage. The SQL Server data type uniqueidentifier stores a GUID value. You can either generate this value within SQL Server—using the NEWID() function—or you can generate the GUID outside of SQL Server and insert it manually.
The base System class in the .NET Framework includes the GUID value type. In addition,this value type includes methods to work with GUID values. In particular,the NewGUID method allows you to easily generate a new GUID.
Language and Platform
VB.NET 2005
Compiler
This code segment is for VB.NET 2005
Version
1.0.0.0
Code
Private Sub GenerateGUID() Dim strGUID As String strGUID = System.Guid.NewGuid.ToString() MessageBox.Show(strGUID ) End Sub
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。