|
- set iCon = CreateObject("Adodb.connection")
- set rs = CreateObject("Adodb.Recordset")
- set xlapp = CreateObject("Excel.Application")
- set ExcelBook = xlapp.workbooks.open("D:\2007-11\20080403job\CMXRVM.csv")
- set ExcelSheet = ExcelBook.ActiveSheet
- xlapp.visible = true
- strCon = "UID=sa;PWD=123;Database=SAMCAT;"& _
- "Driver={SQL Server};"& _
- "Server=.;Provider=SQLOLEDB.1"
- iCon.Open strCon
- strSQLrs = "select * from CAT_ExchangeRates"
- rs.Open strSQLrs,iCon,adOpenForwardOnly,1,adCmdText
- msgbox rs.EOF
- do while count <>2
- arr(suffix) = ExcelBook.worksheets("CMXRVM").cells(i,j).value
- if arr(suffix)="" then
- count = count + 1
- end if
- suffix = suffix + 1
- j = j + 1
- if j>5 then
- suffix = 0
- j = 1
- i = i + 1
- if arr(3)="CLOSE" then
- strSQL = "insert into CAT_ExchangeRates(nvrCurrency1,nvrCurrency2,ftRate,nvrImporSystemDate)"& _
- " values('"&arr(0)&"','"&arr(1)&"','"&arr(4)&"','"&arr(2)&"')"
- iCon.Execute strSQL
- end if
- end if
- loop
- msgbox "insert ok!"
复制代码 我通過這樣的方法把數據插入數據庫中,但記錄多的話就很慢,怎樣才能把插入的速度加快呢? |
|