Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:57:10+00:00 2026-06-09T05:57:10+00:00

I used to use RNGCryptoServiceProvider to generate string-based Order ID’s, but, there were 4

  • 0

I used to use RNGCryptoServiceProvider to generate string-based Order ID’s, but, there were 4 instances where ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@$%^*()_- would generate an already-existing Order ID.

And it got me thinking…

Why can’t we just use something like:

<html>
...
<p>@GenerateOrderId()</p>
...
</html>

and:

public string GenerateOrderId()
{
   return "OID" + 
      DateTime.Now.Year + DateTime.Now.Month +
      DateTime.Now.Day + 
      DateTime.Now.Hour + 
      DateTime.Now.Minute + 
      DateTime.Now.Second + 
      DateTime.Now.Millisecond;
}

I’ve been told that it’s a bad idea, but without any explanation, or reason, it’s still stuck in my head.
… The reason I’d like to use this, is because it will always be unique.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:57:11+00:00Added an answer on June 9, 2026 at 5:57 am

    Computers work at nanosecond speeds. You would be guaranteed to generate a duplicate order ID almost immediately.

    Your best bet would be to use a GUID [MSDN-C#] [MSDN-SQL] (a.k.a. UNIQUEIDENTIFIER in the SQL world).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to use List.h to work with lists in C++, but are there
I used to use currentSchema=MYSCHEMA; in my JDBC URL connection, but the version of
We used to use Visual Source Safe and there was one neat feature that
I used to use the function below for an array or IP's but now
I used to use 'GetSchemaTable' to read schema information, but it was missing some
I used to use VC 6 a while back and there was a simple
I used to use @RequestParam(a-b) String foo to receive the a-b parameter from http
I used to use mysql, and in mysql database hold tables, but these concepts
I am used to use generics in typed collections, but I never actually used
I used to use subversion, but it's been a few years. I've been using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.