473,805 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a UNIQUE value

I need to create a UNIQUE number similar to a GUID but all numbers. Does
anyone know of an algorithm or anything?

TIA,

Dave
Jul 21 '05 #1
2 1295
Hi David,

In case you are looking at how to create GUID, then the framework has a
class called System.Guid, which does this...

Very simple... Have a look at these links....for code snippets
http://www.csharphelp.com/archives/archive188.htm
http://msdn.microsoft.com/library/de...ClassTopic.asp

In case you want to write / use algorithm for generating the number, then
check this link for code snippet in C#...
http://www.c-sharpcorner.com/1/unique.asp

HTH,

Need any help, do post a msg back..
Happy Coding


"David Pope" wrote:
I need to create a UNIQUE number similar to a GUID but all numbers. Does
anyone know of an algorithm or anything?

TIA,

Dave

Jul 21 '05 #2
Hi David

How about System.DateTime .Now.Ticks

it gives you a unique number as long as the number is not created too
rapidily.....

just an idea....

"David Pope" <dp***@nospam.s atx.rr.com> wrote in message
news:uR******** *****@TK2MSFTNG P12.phx.gbl...
I need to create a UNIQUE number similar to a GUID but all numbers. Does
anyone know of an algorithm or anything?

TIA,

Dave

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2306
by: kevin parks | last post by:
hi. I've been banging my head against this one a while and have asked around, and i am throwing this one out there in the hopes that some one can shed some light on what has turned out to be a tough problem for me (though i am getting closer). i have been mucking with a lot of data in a dictionary that looks like:
4
6836
by: RCS | last post by:
We have sort of a centralized single-signon written in ASP.NET for all of our legacy ASP and ASP.NET apps.. There are around 1200 users and something like 2 dozen apps. Everyonce in a while, a user gets the error that their session is a duplicate in the database.. I talked to the database guys about putting in a job that cleans up old sessions, but I also want to have this work a little cleaner on the front-end. I need to generate a...
7
2155
by: Robin | last post by:
In a current .Net solution (using VB.Net) has a 3 tier architecture of Web interface, Data Access Layer and Database. How do I implement business logic and class layers into this solution?
1
6344
by: Danny Liberty | last post by:
I need some opionions on an issue here... Suppose I want to keep a collection of objects, each need to be uniquely identified by a number. This number has no meaning as long as it's unique, so it should be automatically generated for each new object. One more requirement is keeping the objects in the order in which they were inserted, not sorted by their ID. Considering the following options of implementation, which would be the best...
8
2075
by: DaTurk | last post by:
Hi, I was just curious how you would go about creating a unique identifier with 3 ints.
3
14583
by: travis.downs | last post by:
Hi, I'm trying to use a macro to create a unique temporary variable name, such as #define TEMP_OBJ(string) MyType obj_ <some magic here(string); So something like TEMP_OBJ("foo")
4
1597
by: redqil | last post by:
The problem I am facing is that an integer is the ideal representation for many different classes I am using. I want to write overloaded functions that are able to differentiate between the classes without mutual interference. The naive, yet wrong, solution is: typedef int A; typedef int B; void f(A a); void f(B b); // Error
13
12805
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new scripting language that makes writing automated tests simpler. Really, I'm looking to kind of abstract the power of the C# language into a simpler language that's easier to learn. The script files would be interpreted by a script interpreter...
4
1659
by: sekundes | last post by:
hi im new here and still a beginner in C. i need an answer to this problem and hopefully u can help me in this. we have this challenge asked by an instructor to create an array program that will input integers and if you input an integer it must have no same input value with other array index and will not accept it. therefore it is unique. example if i input 1 in array, array will only have the integer 1 on it and no other. this is all...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.