|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
优点:简单易学、开发速度快、有很多年“历史”,能找到非常多别人做好的程序来用、配合activeX功能强大,很多php做不到的asp+activeX能做到,例如银行安全控件asp+|sql|初学|数据|数据库<%
//查询办法
//----------------------------(1)-------------------------------
SetRsWorkUserInfo=Server.CreateObject("ADODB.RecordSet")
StrSql="SelectUsersId,LoginName,UserName,Password"
StrSql=StrSql&"FromUsers"
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
IfRsWorkUserInfo.State=1Then
RsWorkUserInfo.Close
EndIf
RsWorkUserInfo.OpenStrSql,Conn,1,1
IfNotRsWorkUserInfo.EofThen
LoginName=RsWorkUserInfo("LoginName")
UserName=RsWorkUserInfo("UserName")
Password=RsWorkUserInfo("Password")
Endif
RsWorkUserInfo.Close
SetRsWorkUserInfo=Nothing
//----------------------------(2)-------------------------------
StrSql="SelectUsersId,LoginName,UserName,Password"
StrSql=StrSql&"FromUsers"
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
SetRsFind=Conn.Execute(StrSql)
IfNotRsFind.EofThen
LoginName=RsFind("LoginName")
UserName=RsFind("UserName")
Password=RsFind("Password")
Endif
RsFind.Close
SetRsFind=Nothing
//修正办法
//----------------------------(1)-------------------------------
SetRsWorkUserInfo=Server.CreateObject("ADODB.RecordSet")
StrSql="SelectUsersId,LoginName,UserName,Password"
StrSql=StrSql&"FromUsers"
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
IfRsWorkUserInfo.State=1Then
RsWorkUserInfo.Close
EndIf
RsWorkUserInfo.OpenStrSql,Conn,1,3
IFNotRsWorkUserInfo.EofThen
RsWorkUserInfo("LoginName")=LoginName
RsWorkUserInfo("UserName")=UserName
RsWorkUserInfo("Password")=Md5(Password)
RsWorkUserInfo.Update
Update=True
Else
Update=False
Endif
RsWorkUserInfo.Close
SetRsWorkUserInfo=Nothing
//----------------------------(2)-------------------------------
StrSql="UpdateUsers"
StrSql=StrSql&"SetLoginName="&SqlStr(LoginName)&",UserName="&SqlStr(UserName)&",Password="&SqlStr(Password)
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
Conn.Execute(StrSql)
//增加办法
//----------------------------(1)-------------------------------
SetRsWorkUserInfo=Server.CreateObject("ADODB.RecordSet")
StrSql="SelectUsersId,LoginName,UserName,Password"
StrSql=StrSql&"FromUsers"
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
IfRsWorkUserInfo.State=1Then
RsWorkUserInfo.Close
EndIf
RsWorkUserInfo.OpenStrSql,Conn,1,3
IfRsWorkUserInfo.EofThen
RsWorkUserInfo.AddNew
RsWorkUserInfo("UsersID")=tUserId
RsWorkUserInfo("LoginName")=LoginName
RsWorkUserInfo("UserName")=UserName
RsWorkUserInfo("Password")=Md5(Password)
RsWorkUserInfo.Update
NewRecord=True
Else
NewRecord=False
Endif
RsWorkUserInfo.Close
SetRsWorkUserInfo=Nothing
//----------------------------(2)-------------------------------
StrSql="InsertIntoUsers(UsersId,LoginName,UserName,Password)"
StrSql=StrSql&"Values("&SqlStr(tUserID)&","&SqlStr(LoginName)&","&SqlStr(UserName)&","&SqlStr(Password)&")"
Conn.Execute(StrSql)
//删除办法
//----------------------------(1)-------------------------------
SetRsWorkUserInfo=Server.CreateObject("ADODB.RecordSet")
StrSql="DeleteFromUsers"
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
IfRsWorkUserInfo.State=1Then
RsWorkUserInfo.Close
EndIf
RsWorkUserInfo.OpenStrSql,Conn,1,3
RsWorkUserInfo.Close
SetRsWorkUserInfo=Nothing
//----------------------------(2)-------------------------------
StrSql="DeleteFromUsers"
StrSql=StrSql&"WhereUsersId="&SqlStr(tUserID)
Conn.Execute(StrSql)
%>
大家可以自己去看一看.可以说看得想呕吐.以前有次下了个动网来看.里面连基本内置函数的保护措施(函数没防御性)都没有.难怪经常补这个补那个了.可能现在.NET版会好点吧 |
|