求助:下面的运行出来,提示:编译错误:在end sub,end function,或end属性后只能出现注释。
这是为什么啊?望高人指点啊.
Private Sub Form_Load() Dim machine As String Dim machine_decode As String Dim txtsql As String Dim mrc As ADODB.Recordset Dim msgtext As String machine = GetSerialNumber("c:") machine_decode = getserial() Text1.Text = machine txtsql = "select * from userenroll_info where machine = '" & machine & "' and decode='" & machine_decode & "'" Set mrc = ExecuteSQL(txtsql,msgtext) If mrc.EOF Then MsgBox "没有注册信息!" cmdok.Visible = False cmdenroll.Visible = True Else MsgBox "找到注册信息" cmdok.Visible = True cmdenroll.Visible = False Label2.Visible = False Label3.Visible = False Text1.Visible = False Text2.Visible = False End If Set mrc = Nothing End Sub Private Sub cmdok_click() Unload Me frmmain.Show End Sub Private Sub cmdcancel_click() End End Sub Function GetSerialNumber(strDrive As String) As Long Dim SerialNum As Long Dim Res As Long Dim Temp1 As String Dim Temp2 As String Temp1 = String$(255,Chr$(0)) Temp2 = String$(255,Chr$(0)) Res = GetVolumeInfomation(strDrive,Temp1,Len(Temp1),SerialNum,Temp2,Len(Temp2)) GetSerialNumber = SerialNum End Function Function getserial() As String Dim inputserial As String Dim n As String Dim n1 As String Dim n2 As String Dim p As Long Dim p1 As Long Dim p2 As Long Dim i As Long p = 0 p1 = 0 p2 = 0 n = "" n1 = "" n2 = "" n = Str(GetSerialNumber("c:")) n1 = "" n2 = "" If Len(n) < 20 Then n = n + String(20 - Len(n),"z") n1 = n1 + String(20 - Len(n),"A") n2 = n2 + String(20 - Len(n2),"H") End If For i = 1 To 20 p = p + Asc(Mid(n,i,1)) * 199 p1 = p1 + Asc(Mid(n1,1)) * 179 p2 = p2 + Asc(Mid(n2,1)) * 109 Next inputseial = Format(p) + "-" + Format(p1) + "-" + Format(p2) getserialn = inputseial End Function Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String,ByVal lpVolumeNameBuffer As String,ByVal nVolumeNameSize As Long,lpVolumeSerialNumber As Long,lpMaximumComponentLength As Long,lpFileSystemFlags As Long,ByVal lpFileSystemNameBuffer As String,ByVal nFileSystemNameSize As Long) As Long
Private Sub cmdenroll_Click() Dim txtsql As String Dim mrc As ADODB.Recordset Dim msdtext As String If Len(Text2.Text) <> 20 Then MsgBox "您输入的注册码错误!" Exit Sub If Text2.Text <> getsrialn() Then MsgBox "注册码错误,请重新输入!" Exit Sub End If On Error GoTo err1 txtsql = "INSERT INTO userenroll_info(machine,decode) values('" & Text1.Text & "','" & Text2.Text & "')" Set mrc = ExecuteSQL(txtsql,msgtext) MsgBox "注册成功!" cmdok.Visible = True cmdenroll.Visible = False Label2.Visible = False Label3.Visible = False Text1.Visible = False Text2.Visible = False Exit Sub errl: MsgBox "添加注册信息失败!" End Sub (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|