会 员 登 录
热 门 文 章
相 关 文 章
- 没有文章
Tags(标签)
谈谈数据从sql server数据库导入mysql数据库的体验
case "application/x-rar-compressed"
ext="rar"
case "application/x-zip-compressed"
ext="zip"
case "image/gif"
ext="gif"
case "image/pjpeg"
ext="jpg"
case "text/plain"
ext="txt"
case else
ext="x"
end select
if ext<>"x" then
set fso=server.createobject("FileSystemObject")
fName="attech"&i&"."&ext
Dir="d:attach"
If fso.FileExists(Dir & fName) Then fso.deletefile Dir & fName
If fName<>"" AND NOT fso.FileExists(Dir & fName) Then
Set strm1=Server.CreateObject("ADODB.Stream")
strm1.Open
strm1.Type=1 'Binary
strm1.Write filevalue
strm1.SaveToFile Dir & fName,2
Set strm1=Nothing
end if
makeattach=fName
end if
end function
这个函数有3个输入参数,第一个是文件的contentType,第二个是文件的二进制数值,第三个是个可以区别文件名的变量,先根据contentType确定所存文件的后缀名,然后就是将二进制数值保存成指定文件名的文件,并将文件名作为输出参数返回,将返回的参数作为数据写到mysql的数据库中保存。
时间匆忙,先总结到这里,希望这些文字能对有需要的人有些帮助,少走些弯路,感谢您的阅读。:)
ext="rar"
case "application/x-zip-compressed"
ext="zip"
case "image/gif"
ext="gif"
case "image/pjpeg"
ext="jpg"
case "text/plain"
ext="txt"
case else
ext="x"
end select
if ext<>"x" then
set fso=server.createobject("FileSystemObject")
fName="attech"&i&"."&ext
Dir="d:attach"
If fso.FileExists(Dir & fName) Then fso.deletefile Dir & fName
If fName<>"" AND NOT fso.FileExists(Dir & fName) Then
Set strm1=Server.CreateObject("ADODB.Stream")
strm1.Open
strm1.Type=1 'Binary
strm1.Write filevalue
strm1.SaveToFile Dir & fName,2
Set strm1=Nothing
end if
makeattach=fName
end if
end function
这个函数有3个输入参数,第一个是文件的contentType,第二个是文件的二进制数值,第三个是个可以区别文件名的变量,先根据contentType确定所存文件的后缀名,然后就是将二进制数值保存成指定文件名的文件,并将文件名作为输出参数返回,将返回的参数作为数据写到mysql的数据库中保存。
时间匆忙,先总结到这里,希望这些文字能对有需要的人有些帮助,少走些弯路,感谢您的阅读。:)
附件:
没有附件
0
票
顶一下
票
顶一下
0
票
踩一下
票
踩一下
| 文 章 评 论 | ||||||||
| ||||||||



您现在的位置: