您好,欢迎访问三七文档
例7-3,--ADOVBS.INC也可换成文件名ADOVBS.TXT包含时也使用这个名字。=============================%ConstadOpenForwardOnly=0ConstadOpenKeyset=1ConstadOpenDynamic=2ConstadOpenStatic=3'----CursorOptionEnumValues-------ConstadHoldRecords=&H00000100ConstadMovePrevious=&H00000200ConstadAddNew=&H01000400ConstadDelete=&H01000800ConstadUpdate=&H01008000ConstadBookmark=&H00002000ConstadApproxPosition=&H00004000ConstadUpdateBatch=&H00010000ConstadResync=&H00020000ConstadNotify=&H00040000'----LockTypeEnumValuesConstadLockReadfnly=1ConstadLockPessimistic=2ConstadLockOptimistic=3ConstadLockBatchOptimistic=4'----ExecuteOptionEnumValuesConstadRunAsync=&H00000010'----ObjectStateEnumValuesConstadStateClosed=&H00000000ConstadStateOpen=&H00000001ConstadStateConnecting=&H00000002ConstadStateExecuting=&H00000004'----CursorLocationEnumValues-------ConstadUseServer=2ConstadUseClient=3'----DataTypeEnumValues--------ConstadEmpty=0ConstadTinyInt=16ConstadSmallInt=2ConstadInteger=3ConstadBigInt=20ConstadUnsignedTinyInt=17ConstadUnsignedSmallInt=18ConstadUnsignedInt=19ConstadUnsignedBigInt=21ConstadSingle=4ConstadDouble=5ConstadCurrency=6ConstadDecimal=14ConstadNumeric=131ConstadBoolean=11ConstadEnrror=10ConstadUserDefined=132ConstadVariant=12ConstadIDispatch=9ConstadIUnknown=13ConstadGUID=72ConstadDate=7ConstadDBDate=133ConstadDBTime=134ConstadDBTimeStamp=135ConstadBSTR=8ConstadChar=129ConstadVarChar=200ConstadLongVarChar=201ConstadWChar=130ConstadVarWChar=202ConstadLongVarWChar=203ConstadBinary=128ConstadVarBinary=204ConstadLongVarBinary=205'----EditModeEnumValues--------ConstadEditNone=&H0000ConstadEditInProgress=&H0001ConstadEditAdd=&H0002ConstadEditDelete=&H0004'----SearchDirectionValuesConstadSearchForward=1ConstadSearchBackward=-1'----ConnectPromptEnumValues-----ConstadPromptAlways=1ConstadPromptComplete=2ConstadPromptCompleteRequired=3ConstadPromptNever=4%例7-4:LogRegist.Asp,新用户注册的程序。==============================================%@Language=VBScript%!--#INCLUDEFILE=ADOVBS.INC--%DimlStrSQL,lRecItem,lStrDbConnStrDimlErrNo,lErrMesDimlIsMod,lStudentIdDimlStudent(6,0)lStrDbConnStr=DSN=logSetlRecItem=Server.CreateObject(ADODB.RecordSet)lErrNo=0IfRequest.Form(CmdClose)=返回ThenResponse.RedirectLogCheck.AspEndIfSelectCaseRequest.Form(CmdReg)Case退出Response.RedirectLogCheck.AspCase确认IfRequest.Form(txtStId)=_OrRequest.Form(txtStName)=_OrRequest.Form(txtStPws)=_OrRequest.Form(txtStPws2)=ThenlErrNo=14ElseIfRequest.Form(txtStPws)Request.Form(txtStPws2)ThenlErrNo=15EndIfEndIflStudent(0,0)=Request.Form(TxtStId)lStudent(1,0)=UCase(Request.Form(TxtStName))lStudent(2,0)=Request.Form(TxtStCI)lStudent(5,0)=Request.Form(TxtStPws)lStudent(3,0)=Request.Form(TxtStUnit)lStudent(4,0)=Request.Form(TxtStContact)lStudent(6,0)=Request.Form(TxtStPhone)lIsMod=Request.Form(TxtMod)IflErrNo=0ThenlErrNo=20lStrSQL=SELECT*FROMTb1_StudentInfo_&WHEREStudentId='&lStudent(0,0)&';'使用单引号,则数据库表Tb1_StudentInfo中'的StudentId字段应是字符型(文本型)lRecItem.OpenlStrSQL,lStrDbConnStr,adOpenDynamic,adLockOptimisticIflRecItem.EOFOrlRecItem.BOFThenlRecItem.AddNewElseIflIsMod=FalseThenlErrNo=13'记录已经存在EndIfEndIfIflErrNo=20ThenlRecItem.Fields(StudentId)=lStudent(0,0)lRecItem.Fields(StudentName)=lStudent(1,0)lRecItem.Fields(StudentCI)=lStudent(2,0)lRecItem.Fields(StudentPwd)=lStudent(5,0)lRecItem.Fields(StudentUnit)=lStudent(3,0)lRecItem.Fields(Contact)=lStudent(4,0)lRecItem.Fields(Telephone)=lStudent(6,0)lRecItem.UpdateEndIflRecItem.CloseEndIfCaseElselStudentId=lIsMod=TrueEndSelectSetlRecItem=NothingSelectCaselErrNoCase20lErrMes=您已经注册成功。Case13lErrMes=该账号已经存在,请与系统管理员联系!。Case14lErrMes=账号、用户姓名及两次口令不能有空值。Case15lErrMes=两次输入的口令不同。CaseElselErrMes=EndSelect%HTMLHEADmetahttp-equiv=Content-Typecontent=text/html;charset=gb2312TITLE新用户注册/TITLE/HEADBODYP%=lErrMes%/p%IflErrNo20Then%P新用户注册/PFORMaction=LogRegist.Aspmethod=post帐号INPUTname=TxtStIdmaxlength=15value=%=lStudent(0,0)%BR姓名INPUTname=TxtStNamemaxlength=20value=%=lStudent(1,0)%BR身份证号INPUTname=TxtStCImaxlength=15value=%=lStudent(2,0)%BR单位INPUTname=TxtStUnitvalue=%=lStudent(3,0)%BR联系方式INPUTname=TxtStContactvalue=%=lStudent(4,0)%BR电话INPUTname=TxtStPhonevalue=%=lStudent(6,0)%BR口令INPUTname=TxtStPwstype=passwordmaxlength=10BR口令确认INPUTname=TxtStPws2type=passwordmaxlength=10BRINPUTaccessKey=ENTERname=CmdRegtype=submitvalue=确认INPUTname=CmdRegtype=submitvalue=退出BRINPUTname=TxtModtype=hiddenvalue=%=lIsMod%/FORM%Else%FORMaction=LogRegist.Aspmethod=POSTname=FormClosePalign=centerINPUTtype=submitvalue=返回name=CmdClose/P/FORM%EndIf%/BODY/HTML例7-5:Logcheck.Asp,这是用户进行登陆的程序。=============================================%@Language=VBScript'例7-5:Logcheck.Asp,这是用户进行登陆的程序。%!--#INCLUDEFILE=ADOVBS.INC--%DimlStrSQL,lRecItem,lStrDbConnStrDimlUserId,lUserPws,lCmdFunDimlErrNo,lErrMeslCmdFun=Request.Form(CmdFun)lErrNo=0SelectCaselCmdFunCase登录lUserId=UCase(Request.Form(TxtUserId))lUserPwd=Request.Form(TxtUserPwd)lStrDbConnStr=DSN=logSetlRecItem=Server.CreateObject(ADODB.RecordSet)lStrSQL=SELECT*
本文标题:动态网站之作4
链接地址:https://www.777doc.com/doc-2614852 .html