作者:mobiledu2502930413 | 来源:互联网 | 2023-09-24 15:47
第一步:获取本计算机用户名
Private Sub Form_Load (重点内容Dim sBuffer As String )缓冲区dimlsizeaslOngsbuffer=space $ 65255 )缓冲区容量255字节, sBuffer包括255个空间字符串lSize=len(sBuffer )、sBuffer字符串长度call getusername (sbuffer,lsize )、sbufer的I flsize0then txtusername
privatesubcmdok _ click (dimtxtsqlasstringdimmrcasadodb.recordsetdimmsgtextasstringusername=' if trim ) txtusername.click '警告' txtusername.setfocuselsetxtsql=' select * fromuser _ infowhereuser _ id=' txtusernamation
publicfunctionexecutesql (byvalsqlasstring, msgstringasstring (as adodb.recordset ' executesqlandreturnrecordsetdimcnnasadodb.connectiondimrstasadodb.recordsetdetdddimstims rrorstokens=split(SQL ) set CNN=new adodb.connection CNN.open connect string 3358 www.open connect string
公共功能连接字符串() as字符串)用文件DSN标记,ODBC数据源connect string=' filedsn=student.DSN; UID=sa; PWD=123456 ' '连接文件DSN end function http://www.Sina.com /
ifinstr(insert,DELETE,UPDATE ),ucase$(stokens(0) ) then CNN.executesqlmsgstring=s tokens )0) '查询安全请联系adlockoptimisticsetexecutesql=rstmsgstring=' rst.record count '记录' endifexecuteSQL_exit3360setret
If mrc.EOF Then MsgBox '中没有此用户。 请重新输入用户名!' 、vbOKOnly vbExclamation、'警告' txtusername.setfocuselseiftrim (MRC.fields (1)=trim ) txtpassword.text ) then ok=vbOKOnly vbExclamation,'警告' txtpassword.setfocus txtpassword.text=' ' endif http://www.Sina.com /