📄 checkno.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 615
Left = 1560
TabIndex = 0
Text = "c"
Top = 1200
Width = 975
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Rst As ADODB.Recordset
Public Cnn As ADODB.Connection
Public AA
Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long
Private Sub Form_Load()
Set Cnn = New ADODB.Connection
Cnn.Open "kaoqin", "andy", "1234"
AA = GetSerialNumber(Text1.Text + ":\")
Set Rst = New ADODB.Recordset
Rst.Open "select * from systemno", Cnn, adOpenStatic, adLockBatchOptimistic, adCmdText
If Rst.EOF Then
Rst.AddNew
Rst.Fields(0) = AA
Rst.UpdateBatch
MsgBox "加入成功", vbOKOnly, ""
Else
MsgBox "不能加入", vbOKOnly, ""
Unload Me
End If
Unload Me
End Sub
Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1, AA As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, Temp1, _
Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
AA = SerialNum
GetSerialNumber = SerialNum
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -