A function (VB) that raises 15 identity card numbers (VB)

zhaozj2021-02-16  48

In the case of simultaneous use of new and old ID cards, it is best to save the 18-bit manner after the upgrade in the database. The following function can convert 15-bit data input to 18 bits.

Function IDCODE15TO18 (Scode15 As String) AS String '* Function: Enhance the 15 ID number to 18 (according to GB 11643-1999)' * parameters: original number '* Return: 18-digit number after upgrading Dim i AS Integer Dim Num AS INTEGER DIM CODE AS STRING NUM = 0 IDCODE15TO18 = LEFT (Scode15, 6) "19" Right (Scode15, 9) 'Computing Location for i = 18 to 2 Step -1 Num = Num (2 ^ (i - 1) MOD 11) * (IDcode15to18, 19 - i, 1)) Next I num's 0 code = "1" case 1 code = "0" Case 1 Code = "0" Case 2 CASE = "0" case 2 Code = "x" Case else code = trim (STR (12 - num)) end select idcode15to18 = idcode15to18 codeend function

转载请注明原文地址:https://www.9cbs.com/read-27034.html

New Post(0)