Random number
Hello guys!
I need your help.
This is code behind of my net page (C#).
My problem is check that the random number does not exist in my table tbl_1 where is stored in the field Nr_random.
If the random number generate exist in my table I need generate new number, else register the first random number generate.
how can i do it?
any help?
thank you.
Code:Random RandomClass = new Random(); int RandomNumber = RandomClass.Next(100000000, 999999999); string vowels = "aeiou"; string name = strEMail_user; name = new string(name.Where(c => !vowels.Contains(c)).ToArray()); string[] strresult = name.Split('.'); string stroutput = strresult[1].Substring(0, 3) + " " + strresult[0].Substring(0, 3); string Nr_random = RandomNumber + "-" + stroutput.Replace(" ", "").ToUpper();



Reply With Quote


Bookmarks