CodePudding user response:
The following code compiled with asp, can achieve your requirements, such as don't want to use asp, according to the idea to use a common language to write can you,<%
The function convertsfz (insfzh) 'id number in 2 turns 18 function
STR=""
Str_len=0
RetStr=""
Tempstr=""
I=0
Ll_Sum=0
S=Array (" 1 ", "0", "X", "9", "eight", "7", "6", "5", "4", "3", "2")
N=Array (7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1)
RetStr=""
Str_len=len (insfzh)
If 15 or str_len str_len==17 then
If str_len=15 then 'supplement year
RetStr=mid (insfzh, 1, 6) + "19" + mid (insfzh, 7, 15)
The else
RetStr=insfzh '17 only computing parity
End the if
For I=1 to 17
Tempstr=mid (retStr, I, 1)
Ll_Sum=ll_Sum + CDBL (tempstr) * N (I - 1)
Response. Write (tempstr&" | "& amp; Ll_Sum & amp;" | "& amp; (ll_Sum mod 11) & amp;"
" )
Next
RetStr=retStr & amp; S (ll_Sum mod 11)
The else
RetStr=insfzh
End the if
Convertsfz retStr=
End the Function
The set myconn=server. Createobject (" ADODB. CONNECTION ")
StrSQL="Provider=Microsoft. Jet. The OLEDB. 4.0. Data Source="& amp; Server. MapPath (" your access database name ")
Myconn. Open StrSQL
Set the rs=myconn. Execute (" select id, id number from your data table name where len (id)=15 ")
If not rs. Eof then varr=rs. Getrows () end if
Rs. Close
Set the rs=nothing
If isarray (varr) then
Vend=ubound (varr, 2)
For I=0 to vend
Vid=varr (0, I)
VSFZH=rs (1, I)
Myconn. Execute (" update mytab set id='" & amp; Convertsfz (VSFZH) & amp;" 'where ID="& amp; Vid)
Next
End the if
Myconn. Close
The set myconn=nothing
Response. Write (", ")
%>