28,391
社区成员
发帖
与我相关
我的任务
分享
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
File = Server.MapPath("File1.txt")
Set txt = fs.OpenTextFile(File)
TmpTxt=Txt.ReadAll
TmpArrTxt=Split(TmpText,VBCrLf)
for i=0 to ubound(TmpArrTxt)-1
TmpL=Split(TmpArrTxt(i),"^")
IntoStr=""
UpSqlStr=""
For k=0 to ubound(TmpL)
if k=0 then
IntoStr="Temp"&Int(k+1)
UpSqlStr="'"&TmpL(k)&"'"
else
IntoStr=IntoStr & ",temp"&Int(k+1)
UpSqlStr=UpSqlStr & ",'"&TmpL(k)&"'"
end if
Next
if IntoStr <>"" and UpSqlStr <>"" then
conn.execute("INSERT INTO Temp ("&IntoStr&") VALUES ("&UpSqlStr&")") '这里就是插入数据库的语句,INTO Temp中的Temp是你建的表,首先你要先建立conn与数据库连接上就没问题了!
End If
Next
%>
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
File = Server.MapPath("File1.txt")
Set txt = fs.OpenTextFile(File)
TmpTxt=Txt.ReadAll
TmpArrTxt=Split(TmpText,VBCrLf)
for i=0 to ubound(TmpArrTxt)-1
TmpL=Split(TmpArrTxt(i),"^")
IntoStr=""
UpSqlStr=""
For k=0 to ubound(TmpL)
if k=0 then
IntoStr="Temp"&k
UpSqlStr="'"&TmpL(k)&"'"
else
IntoStr=IntoStr & ",temp"&k
UpSqlStr=UpSqlStr & ",'"&TmpL(k)&"'"
end if
Next
if IntoStr <>"" and UpSqlStr <>"" then
conn.execute("INSERT INTO Temp ("&IntoStr&") VALUES ("&UpSqlStr&")")
End If
Next
%>
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
File = Server.MapPath("File1.txt")
Set txt = fs.OpenTextFile(File)
TmpTxt=Txt.ReadAll
TmpArrTxt=Split(TmpText,VBCrLf)
for i=0 to ubound(TmpArrTxt)-1
TmpL=Split(TmpArrTxt(i),"^")
IntoStr=""
UpSqlStr=""
For k=0 to ubound(TmpL)
if k=0 then
IntoStr="Temp"&k
UpSqlStr="temp"&k&"='"&TmpL(k)&"'"
else
IntoStr=IntoStr & ",temp"&k
UpSqlStr=UpSqlStr & ",'"&TmpL(k)&"'"
end if
Next
if IntoStr <>"" and UpSqlStr <>"" then
conn.execute("INSERT INTO Temp ("&IntoStr&") VALUES ("&UpSqlStr&")")
End If
Next
%>