在C#中创建唯一编号 [英] create unique number in c#
本文介绍了在C#中创建唯一编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在单击按钮时在asp.net4 Web应用程序中创建唯一编号并将其保存到数据库中.
how can i create a unique number in asp.net4 web application on button click and save it into a database.
推荐答案
此处是有关生成唯一编号的文章C#中的数字
在C#中生成唯一编号 [身份属性 [ ^ ].
Here is a article on generating Unique numbers in C#
Generate Unique Number in C#[^]
However if you looking to create unique values to insert into database i would recommend you to use Identity Property[^] in the SQL SERVER.
您好,这篇很好的文章位于
Hi this a very good article on Random And Unique Code Generation
This is just the logic / Implement it in what ever language you want to.
将 GUID [^ ]满足您的需求吗?对象System.GUID
有一个静态方法NewGuid
,可让您生成几乎可以保证唯一的标识符.
Would a GUID[^] meet your needs? The objectSystem.GUID
has a static method,NewGuid
, that lets you generate an identifier pretty much guaranteed to be unique.
这篇关于在C#中创建唯一编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文