Ef+mvc+bootstrap Project Practice Day9

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.