ASP编程教程技巧综合大全(49)
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