Select Case e.DataCol.Name
Case "ID","类别"
Dim dr As DataRow = e.DataRow
If dr.IsNull("ID") OrElse dr.IsNull("类别") Then
dr("二维码") = Nothing
Else
Dim n As Integer = 14 '要生成密码长度
Dim str() As String = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S" , "T", "U", "V", "W", "X", "Y", "Z"}
For i As Integer = 1 To str.Length '洗牌测次数
Dim n1 As Integer = Rand.Next(str.Length)
Dim n2 As Integer = Rand.Next(str.Length)
Dim temp As String = str(n1)
str(n1) = str(n2)
str(n2) = temp
Next
Dim s As String = String.Join("", str)
If n > s.Length Then
n = s.Length
End If
dr("二维码") = s.Substring(0, n)
End If
End Select