-1

I want to generate 3 digit random numeric string on a click event of button 'NextAvailable' in MVC3 Razor c#.net. The numeric string should be non repeated and before generation of numeric string I need to check in SQL 2008 database, that whether the string is present or not. If present, then generate a new numeric string. I am very much new to MVC-3. Is there any help for View and Controller code? Or any logic that how should i achieve this functionality? It would be a great help.

1
  • Do you need help on the logic side or on the web side? These are very different situations. Commented Jun 4, 2013 at 17:08

1 Answer 1

0

3 unique digits means there can only be 999 items in your database, that may or may not be a problem. also, if there are only 999 entries available, why do they need to be random?

Regardless, identifying and selecting the next item in a sequence is a problem that can be solved in your database with a stored procedure. Your controller would execute the stored procedure via a method on one of your repository objects.

It looks like this functionality is built into Sql Server 2012, otherwise, you can build your own - here is an explanation on how to do that: Generating next sequence number in sql server

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.