将随机ID格式化为yy-xxxxxxxx

时间:2015-11-16 14:32:21

标签: mysql vb.net random

如何将随机ID号格式化为yy-xxxxxxxx

前2位是当前年份的最后2位数字,然后是破折号,然后是随机数字***

这是我的代码:

  Public Class frmNewPatient
        Dim MySqlConn = New MySqlConnection("server=localhost;user id=root;password=root;database=PatientManagementSystem;")
        Dim Birthdate, day, month, year As String
        Const RndString = "123450ABCab"
        Dim cmd As New MySqlCommand

        Private Sub frmNewPatient_Load(sender As Object, e As EventArgs) Handles MyBase.Load

            ' AUTO GENERATE RANDOM IDs '
            Dim random As New Random
            Dim id As Integer
            id = (random.Next(100000000, 1000000000))
            txtID.Text = id
    End sub
End Class

0 个答案:

没有答案