<%
set conn=server.createobject("adodb.connection")
conn.open 'web', 'admin', '123456' // 'web'是sqlserver中mydb的数据源名,
'admin'是访问mydb的用户名,'123456'是访问mydb的密码
set rs=server.createobject("adodb.recordset")
sql="select ID,name,username,password,
datediff(s,'1970-01-01 00:00:00',recdate)-
8*3600,reid,filename,fileContentType,filevalue from senddate"
//这条sql语句实现了将datetime类型的recdate字段转化成unix时间戳的int型
rs.open sql,conn,1,3
set conn1=server.createobject("adodb.connection")
conn1.open "myoa","root","q1-d6=7?"
i=1
do while not rs.eof
field1 = rs(0)
field2 = rs(1)
field3 = rs(2)
field4 = rs(3)
field5 = rs(4)
sql1 = "insert into user(ID,name,username,password,recdate)
values("&field1&",'"&field2&"','"&field3&"','"&field4&"',"&field5&")"
conn1.execute sql1
rs.movenext
i=i+1
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
conn1.close
set conn1=nothing
%> |