日期:2014-05-16 浏览次数:21162 次
sConn = "Server=127.0.0.1;Database=db;User Id=xxx;Password=xxx;"
Set conn = CreateObject("ADODB.Connection")
conn.Open sConn
Set rs = CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open "SELECT xx FROM tbl WHERE 1=0", 1, 4
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFile = oFS.OpenTextFile("c:\xxx\xxx.txt", 1, False)
Do While Not oFile.AtEndOfStream
sLine = oFile.ReadLine()
rs.AddNew
rs("xx") = sLine
Loop
oFile.Close
Set oFile = Nothing
Set oFS = Nothing
rs.UpdateBatch
If rs.State<>0 Then rs.Close
conn.Close
Set conn = Nothing
sConn = "Server=127.0.0.1;Database=db;User Id=xxx;Password=xxx;"
Set conn = CreateObject("ADODB.Connection")
conn.Open sConn
Set rs = CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open "SELECT xx FROM tbl WHERE 1=0", 1, 4
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFile = oFS.OpenTextFile("c:\xxx\xxx.txt", 1, False)
Do While Not oFile.AtEndOfStream
sLine = oFile.ReadLine()
rs.AddNew
rs("xx") = sLine
Loop
oFile.Close
Set oFile = Nothing
Set oFS = Nothing
rs.UpdateBatch
If rs.State<>0 Then rs.Close
conn.Close
Set conn = Nothing