我是菜鸟一个,昨天做作业,察看别人的模板做法时,这他定义的这两个函数过程不懂有什么用,还望各位大虾,哥哥姐姐们帮着看看,如果上传的不全请指出。谢谢了
Public Function IniDB() As Boolean On Error GoTo on_dberr g_DBcon.Execute ("CREATE TABLE Managelist (Mname Char(32),Mpwd char(16))") g_DBcon.Execute ("CREATE TABLE EmpList (Enumber Char(32) PRIMARY KEY , Ename char(16),Eage int,Edate char(32),Eaddress char (128))") IniDB = True Exit Function on_dberr: MsgBox "错误代码:" & Err.Number & vbCr & _ "错误描述:" & Err.Description, vbCritical + vbOKOnly, "狗狗提示" IniDB = False End Function
Public Function QueryEmpInfo(ByVal strsql As String) As Boolean On Error GoTo ON_QueryERR Set g_DBRct = Nothing '重新查询 Call g_DBRct.Open(strsql, g_DBcon, adOpenDynamic, adLockOptimistic, -1) QueryEmpInfo = True Exit Function
ON_QueryERR: MsgBox "错误代码:" & Err.Number & vbCr & _ "错误描述:" & Err.Description, vbCritical + vbOKOnly, "狗狗提示" QueryEmpInfo = False End Function