I'm going to finish the client management today.
First, data preparation
Get more data, practice paging, search, and generate the above data. Random name, cell phone, ID (e.g. UserID only 1, 2, 4, 6 and corresponding username), number (two-bit English and 3 digits)
1, random name. Thanks to the blog Park AngelLee2009 An article inspired me, but slightly complicated, improved a bit
DECLARE @firstNames VARCHAR(MAX)='Fang Hai Bright red June June Army River Lake Borger Yan Yang Yangtao bin bin Wei Wei just Qian' --save a collection of namesDECLARE @lastNames VARCHAR(MAX)='Liufang Huang Winding Zeng Tu' --save a collection of last namesDeclare @i int = 1 while(@i <= Ten)begin PRINT(SUBSTRING(@lastNames,ABS(CHECKSUM (NEWID()))%LEN(@lastNames)+1,1) + SUBSTRING(@firstNames,ABS(CHECKSUM (NEWID()))%LEN(@firstNames)+1,1) + SUBSTRING(@firstNames,ABS(CHECKSUM (NEWID()))%LEN(@firstNames)+1,1) ) Set @i = @i + 1END
Li Binjiang Zhao just qian Huanghaigang Zhao Yan micro Hu Heiang Wen Binjun Wei Shanhai wei bin micro Wei Yangliang Isi
2, Random mobile phone (13 start)
SELECT ' - ' +right (1000000000+CONVERT(BIGINT,ABS(CHECKSUM (NEWID 9)
The number of digits larger than int to pay attention to turn into bigint,checksum will produce negative numbers, it is best to use ABS (), try this example without ABS is also possible, because there is a layer right ()
In general, the likelihood of repetition is very, very small, and the number of digits is less likely, and the 9-bit random number is almost impossible to duplicate.
If it is used formally in a project, to avoid duplication, you can set a unique index on the column you want to generate and set the Ignore duplicate key to Yes so that when you insert a duplicate key, you skip (not all fail)
This is just a random phone number test, it doesn't matter.
Second, the shared Page menu path display (click the event js)
Ef+mvc+bootstrap Project Practice Day9