大家发些ASP常用代码段,跟帖跟分

veiny 2008-10-23 07:45:13
加精
我先来一点,
Function GetSafeStr(str)
GetSafeStr=Replace(Replace(Replace(Replace(Replace(str,"'","‘"),"""","“"),"&",""),"<","<"),">",">")
End Function
...全文
5918 195 打赏 收藏 转发到动态 举报
写回复
用AI写文章
195 条回复
切换为时间正序
请发表友善的回复…
发表回复
kityjuan 2012-10-11
  • 打赏
  • 举报
回复
td {
border-width: 1px;
onMouseOut: expression(onmouseout=cTo('#ff00ff'));
onMouseOver: expression(onMouseOver=cBack('white'));
}
MyLinda 2012-06-06
  • 打赏
  • 举报
回复
[Quote=引用 196 楼 的回复:]

有没有人能帮我看下这段代码错在哪啊?
Sql = "Select * From [people_on_duty] Where branch="&danwei&" and datem="&date&""
查记录的时候,如果只一个条件是能查到的,如果两个条件则查不到。
我的数据库中存在同时符合两个条件的记录
[/Quote]
ASP里面 时间要加#
zwei_78 2012-06-01
  • 打赏
  • 举报
回复
有没有人能帮我看下这段代码错在哪啊?
Sql = "Select * From [people_on_duty] Where branch="&danwei&" and datem="&date&""
查记录的时候,如果只一个条件是能查到的,如果两个条件则查不到。
我的数据库中存在同时符合两个条件的记录
Aqwe23 2012-05-14
  • 打赏
  • 举报
回复
基本的登录页面
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
[Bindable]
//private var result1:ArrayCollection;
private var login_result:String;
[Bindable]
private var sendChoice:String;
private function goLogin():void{
if(username.text=="" || userpwd.text=="")
Alert.show("没有填写用户名或密码");
else{
sendChoice="login";
login.send();
}
}
private function goRegis():void{
if(username.text=="" || userpwd.text=="")
Alert.show("没有填写用户名或密码");
else{
sendChoice="regis";
login.send();
}
}

private function resultHandler(event:ResultEvent):void{
// login_result=event.result.html.body.users.a.toString();
login_result =event.result.users.a.toString() ;
if(login_result=="ok"){
Alert.show("欢迎,登录成功");
}
if(login_result=="nohave"){
Alert.show("没有找到这个用户名 请先注册!");
}
if(login_result=="pwderror"){
Alert.show("密码错误! 请从新登陆!");
}
if(login_result=="nameishave"){
Alert.show("用户名已经存在,请选择别的用户名注册");
}
if(login_result=="regisok"){
Alert.show("注册成功,请从新登陆");
}
if(login_result=="error"){
Alert.show("错误");
}
}
]]>
</mx:Script>
<mx:HTTPService id="login" method="POST" showBusyCursor="true" url="http://localhost/flex/Flexlogin.php"
result="resultHandler(event)">
<mx:request xmlns="">
<mx:username>
{username.text}
</mx:username>
<mx:userpwd>
{userpwd.text}
</mx:userpwd>
<mx:sendchoice>
{sendChoice}
</mx:sendchoice>
</mx:request>
</mx:HTTPService>
<mx:Panel width="310" height="265" layout="absolute" title="登录" fontSize="12" fontWeight="normal" horizontalCenter="13" verticalCenter="-239">
<mx:TextInput id="username" fontSize="12" restrict="0-9,a-z" maxChars="8" x="0" y="0"/>
<mx:TextInput id="userpwd" fontSize="12" displayAsPassword="true" maxChars="8" restrict="0-9,a-z" x="0" y="30"/>
<mx:Button label="登录" id="btn1" click="goLogin()" fontWeight="normal" fontSize="12" x="0" y="60"/>
<mx:Label text="用户名:" fontSize="12" x="0" y="90"/>
<mx:Label text="密码:" fontSize="12" x="0" y="116"/>
<mx:Button label="注册" fontSize="12" fontWeight="normal" id="btn2" click="goRegis()" x="0" y="142"/>
<mx:Label text="测试用 用户名 user 密码 1234" fontSize="12" width="243" x="0" y="172"/>
</mx:Panel>

</mx:Application>
xylllamm 2012-02-14
  • 打赏
  • 举报
回复
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body bgcolor="#FFFFFF">
<%response.expires=0
bf=request("bf")
str=server.mappath("../backup") '存储数据库的备份路径
set conn=server.createobject("adodb.connection")
conn.open "Driver={Sql Server};Server=(local);UID=sa;pwd=sa;database=DB_Lsmanage"
on error resume next '用于设置错误陷阱
conn.execute "backup database DB_Lsmanage to disk='" & str & "\" & bf & ".sql'"
response.write "<title>提示页面</title><br><br><br><br><br><br><p align='center'><font face='楷体GB2312' size='5' color=#ff0000><b>"
if err.number=0 then
response.write "<script language='javascript'>alert(''数据库备份完成!');window.location.href='../main1.asp';</script>"
else
response.write "<br>数据库备份失败,请检查后重试!</b></font></p><br><center><a href='javascript:history.back(1)'>返回</a></center>"
response.write err.Description '输出系统的错误提示信息
end if
conn.close
set conn=nothing
%>
abcdc1111 2012-02-06
  • 打赏
  • 举报
回复
<DIV id="scrollobj" style="white-space:nowrap;overflow:hidden;width:865px; line-height:43px;"><%Do While Not rs.Eof
Set Rs12 = Server.CreateObject("ADODB.RecordSet")
Sql12 = "SELECT * FROM jiangpin where id ="&rs("jid")&""
Rs12.Open Sql12,Conn,1,1
do while not Rs12.eof %><span style="color:#FF0000">恭喜
<%
Set Rs123 = Server.CreateObject("ADODB.RecordSet")
Sql123 = "SELECT * FROM hyk where hyk_uid ='"&rs("uname")&"'"
Rs123.Open Sql123,Conn,1,1
do while not Rs123.eof
response.Write Rs123("hyk_dj")
Rs123.movenext
loop
Rs123.close
set Rs123=nothing
%>
会员:[<%=rs("uname")%>] 中得§<%if Rs12("jp_dengji")=1 then
response.Write"特等奖"
elseif Rs12("jp_dengji")=2 then
response.Write"一等奖"
elseif Rs12("jp_dengji")=3 then
response.Write"二等奖"
elseif Rs12("jp_dengji")=4 then
response.Write"三等奖"
elseif Rs12("jp_dengji")=5 then
response.Write"四等奖"
elseif Rs12("jp_dengji")=6 then
response.Write"五等奖"
elseif Rs12("jp_dengji")=7 then
response.Write"六等奖"
end if%>§【<%=Rs12("jp_name")%>】;    </span><% Rs12.movenext
loop
rs.movenext
loop%></DIV>
<script language="javascript" type="text/javascript">
function scroll(obj) {
var tmp = (obj.scrollLeft)++;
if (obj.scrollLeft==tmp) obj.innerHTML += obj.innerHTML;
if (obj.scrollLeft>=obj.firstChild.offsetWidth) obj.scrollLeft=0;
}
setInterval("scroll(document.getElementById('scrollobj'))",1);
</script>
masky5310 2010-12-20
  • 打赏
  • 举报
回复
Mark
kaicat 2010-12-18
  • 打赏
  • 举报
回复
好东西,收藏了
yfkjsd 2010-12-17
  • 打赏
  • 举报
回复
收藏 了
redpaca 2010-11-30
  • 打赏
  • 举报
回复
顶顶!!!!!!!!!!!!!!!!!!
redpaca 2010-11-30
  • 打赏
  • 举报
回复
这个好东西啊
各种报错 2010-11-30
  • 打赏
  • 举报
回复
我是新手,学习了。。。
wangso3250 2010-11-28
  • 打赏
  • 举报
回复
很好啊,学习了。
bingling737 2010-11-12
  • 打赏
  • 举报
回复
收藏一下~~~
chorigin 2010-11-12
  • 打赏
  • 举报
回复
。。。。。。。。。。。。。。。。。。。
lly355606625 2010-09-07
  • 打赏
  • 举报
回复
跟帖,留个脚印
gzpydc 2010-09-02
  • 打赏
  • 举报
回复
收藏了,Function就是好用,简化了程序,也简化了工作,呵呵。
bingshanzhiling 2010-08-31
  • 打赏
  • 举报
回复
太威武了。感谢大家
yangchun1213 2010-08-16
  • 打赏
  • 举报
回复
好东西啊,值得收藏啊
mardonma 2010-08-09
  • 打赏
  • 举报
回复
做个记号
加载更多回复(175)

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧