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 853425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:45:24+00:00 2026-05-15T07:45:24+00:00

public int GenPurchaseOrderNum() { Random random = new Random(); _uniqueNum = random.Next(13287, 21439); return

  • 0
public int GenPurchaseOrderNum()
{
    Random random = new Random();
    _uniqueNum = random.Next(13287, 21439);
    return UniqueNum;
}

I removed unique constraint from the PONumber column in the db because an employee
should only generate P.O. # when the deal is set. Otherwise, P.O. # would have 0.

P.O. Number used to have unique constraint, this forces employee to generate P.O. in all cases so the db doesn’t throw unique constraint error.

Since i removed the unique constraint, any quote doesn’t have P.O. will carry 0 value. Otherwise, a unique value is generated for P.O. #. However, i don’t have a unique constraint in db which makes it hard for me to know whether the application generated P.O. # is unique or not.

What should i do?

I hope my question is clear enough

  • 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-05-15T07:45:24+00:00Added an answer on May 15, 2026 at 7:45 am

    A GUID is a bit high in the way of overhead. Specifically, it sounds like you need a human readable number for the PO#, which makes a GUID impractical. I’d be more inclined to use the following scenario.

    1. Remove any NOT NULL constraints you have on the field.
    2. Have a stored procedure that you use to create a new PO that leaves the PO # field NULL. Null is most appropriate in the case described since in the world of DB NULL means “unknown” and since you don’t actually HAVE a PO #, it IS unknown.
    3. Use a stored procedure that updates the field when the deal is complete to increment to the next available PO number. This will happen server side, so it doesn’t matter what client the update comes from it will still be unique to that table. This stored procedure can then return the updated result set (if required) to the client so they can see the new PO #.

    That’s the 20k foot view.

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

Sidebar

Related Questions

This compiles: class Ex1 { public int show() { try { int a=10/10; return
public ActionResult ReadXMLDevices(int groupID) { var query = from k in XMLEntities.unassigneditems where k.DevOrAcc
public int onStartCommand(Intent intent, int flags, int startId){ if(!player.isPlaying()){ player.start(); } return START_STICKY; }
public int getChildrenCount(int groupPosition) { if(children == null){ new SalesRequest().execute(); // runs in other
class A { public: int i; }; A *a = new A(); How to
public int Fibonacci(int x) { int prev = -1; int next = 1; for
public class Person { private int _Id; public int Id{get{return value;} set{_Id=value;}} private string
class User { public: int v() { return min_pass_len; } static const int min_pass_len
public int Test() { int result = 1; SqlCommand cmd = new SqlCommand(spTest, conn);
public int testb; btn.setOnClickListener(new OnClickListener() { public void onClick(View v) { ********* }} How

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.