VB6的代码:
Public db As Database
Public rs As Recordset
Private Sub Command1_Click() '保存
Dim day As String
Dim str As String
Dim num As Integer
num = GetSetting("data", "data", "num", 0) ‘从注册表中获得上次的数字
day = Format(Date, "yyyymmdd") ’获得6位日期
str = Format(Time, "hhnnss") ‘获得6为时间
num = num + 1
Set rs = db.OpenRecordset("select * from CODE_BUFF")
rs.AddNew
rs.Fields(0) = "110001" & day & str & Format(num, "0000") ’组合为字段
rs.Fields…… ‘其他字段
rs.Update
SaveSetting "data", "data", "num", num ‘保存到注册表中
End Sub
Private Sub Form_Load()
Set db = opendatabase(App.Path & "\SXZZ.MDB")
End Sub
[此贴子已经被作者于2003-5-12 12:47:44编辑过]
|