asp常常用到的一些东西
asp常常用到的一些东西,我做东西一般下面的东西经常用(拷贝)
<%=Request.ServerVariables("remote_addr")%>
FOR each item in Request.form
tempvalue=trim(Request(item))
tempvalue=Replace(tempvalue,chr(13)&chr(10),"<br/>")
tempvalue=Replace(tempvalue,"<br/><br/>","<br/>")
if tempvalue="" then tempvalue=0
Execute item&"="""&tempvalue&""""
'response.write item&"="&tempvalue&"<br/>"
next
'response.write request("id")
'response.end
if ="" then
response.write "<script language='javascript'>window.alert('')</script>"
response.write "<script language='javascript'>window.history.go(-1);</script>"
response.end
end if
<!--#include file="" -->
<!--#include virtual="" -->
sql="select max(id) from pack"
set RS=conn.execute(sql)
if isnull(RS(0)) then
id=1
else
id=RS(0)+1
end if
set rs=nothing
sql="insert into pack(id,strpackdm,strusername) values("&id&",'"&strpackdm&"','"&Session("username")&"')"
set RS=conn.execute(sql)
sql="update pack set "&Itemname&"='"&tempvalue&"' where id="&id&""
if Itemname<>"id" then
response.write sql&"<br/>"
set rs=conn.execute(sql)
if err.number<>0 then
'错误处理
response.write "数据库操作失败:" & err.description
err.clear
end if
Set rs=Nothing
Conn.close
Set conn=Nothing
do while not rs.eof and rowcount>0
rowcount=rowcount-1
rs.MoveNext
do while not rs.eof
rs.MoveNext
loop
for each item in rs2.fields
Execute item.name&"="""&trim(rs2(""&item.name&""))&""""
next
function Mycn(str)
str=lcase(str)
str=replace(str,"","")
response.write str
end function
dim conn
dim connstr
on error resume next
set conn=server.CreateObject("adodb.connection")
Connstr="driver=SQL Server; server="&servername&"; uid="&username&"; pwd="&password&"; database="&datebasename&";"
Connstr="DBQ="+server.mappath(mydbpath&mdbname)+";DRIVER={Microsoft Access Driver (*.mdb)};"
'response.write Connstr
'response.end
conn.Open connstr
if err<>0 then
Response.Write "无法建立到数据库的连接!"
end if
版权声明:
作者:Kiyo
链接:https://www.wkiyo.cn/html/2008-01/i97.html
来源:Kiyo's space
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论