中华考试网·阅读新闻
编程开发 > ASP > 文章内容

ASP编程教程技巧综合大全(49)

2015-10-6编辑:ljnbset

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&"
"
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

ASP编程教程技巧综合大全(48)
咨询热线:4000-525-585(免长途费)