TXT文件通过ASP筛选后是这样:
1 2 3 4 5 6 7 8 9 0
a b c d f a b c d e
a b c d e b d e a d
a b c d e b d e a d
a b c d e b d e a d
a b c d e b d e a d
.
.
.
.
---------------------------------------------------------
想导入SQL表中时
1到0(行)分别导入到SQL里的一个表中,其中1里的全部数据对应导入表中字段1,2里的全部数据对应导入表中字段2......0里的全部数据对应导入表中字段0
请问要如何实现?
具体要怎么写呢?
---------------------------------------------------------------
1
2dim fso
3dim f
4dim str
5dim arr(10)
6dim i
7set fso=server.createobject("scripting.filesystemobject")
8Set f = fso.OpenTextFile("c:\testfile.txt", Forreading, True)
9f.Skipline
10Do While f.AtEndOfStream <> True
11str=f.readline
12arr=split(str,"")
13Dim myconnection As New ADODB.Connection
14Dim myrecordset As New ADODB.Recordset
15Dim mysql As String
16Dim myconnectionstring As String
17myconnectionstring = "xxxxxxx"
18myconnection.Open myconnectionstring
19mysql="insert into xxx (1,2........,0) values ("' & arr(0) & "','" & arr(1) & "',.........,'" & arr(9) & "'"
20myrecordset.open mysql,myconnection
21set myrecordset=nothing
22set myconnection=nothing
23loop
试试,就这个意思,不对的地方自己修改下
---------------------------------------------------------------
Dim mysql
Dim myconnectionstring
........
........
mysql="insert into xxx (1,2........,0) values ("' & arr(0) & "','" & arr(1) & "',.........,'" & arr(9) & "')"
.........
.........