建站代码网

热门标签

大容量数据导入SQL 2005

Set conn = Server.CreateObject("ADODB.Connection")
connstr ="provider=sqloledb;data source=(local);User ID=sa;pwd=770912Hzx;Initial Catalog=newimage"

 

conn.Open connstr
 

whichfile=server.mappath(Fname)
Set fso = CreateObject("scripting.FileSystemObject")
if fso.fileExists(whichfile) then   
Set txt = fso.OpenTextFile(whichfile,1,true) 
 
if txt.AtEndOfStream =false Then  
While Not txt.AtEndOfStream
str=txt.ReadLine

sql="INSERT INTO [xuan] (shu) VALUES ('"&str&"' )"
'response.Write sql
'
' response.End()
 
conn.execute(sql)

Wend

 end if
txt.Close 

end if
Set fso = Nothing
 
conn.close :set conn=nothing
 
response.Write  "导入成功"
end if
X