L
liminhan
Unregistered / Unconfirmed
GUEST, unregistred user!
select如何读取文本文件再转换为excel
以下是我再网上找到的,提示为“HTTP 500 - 内部服务器错误”
<%Dim oRs
Dim oConn
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DBQ="+server.mappath("/test.txt"+";DefaultDir=;DRIVER={Microsoft Text Driver (*.txt;
*.csv)};Extensions=asc,csv,tab,txt;"
'oConn.Open "Driver={Microsoft Text Driver (*.txt;
*.csv)};Dbq="
&Server.Mappath("/" & ";Extensions=asc,csv,tab,txt;"
'DB_name="DBQ="+server.mappath("/crct.asa"+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Sql = "Select * From test.txt"
Set oRs = Server.CreateObject("ADODB.RecordSet"
oRs.Open Sql,oConn,1,1
Response.Write "<table border=1 width=400>"
Response.Write "<tr><td>编号</td><td>用户名</td><td>密码</td></tr>"
Do While Not oRs.Eof
Response.Write "<tr><td>"
& oRs(0) & "
</td><td>"
& oRs(1) & "
</td><td>"
& oRs(2) & "
</td></tr>"
oRs.MoveNext
Loop
Response.Write "</table>"
%>
以下是我再网上找到的,提示为“HTTP 500 - 内部服务器错误”
<%Dim oRs
Dim oConn
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "DBQ="+server.mappath("/test.txt"+";DefaultDir=;DRIVER={Microsoft Text Driver (*.txt;
*.csv)};Extensions=asc,csv,tab,txt;"
'oConn.Open "Driver={Microsoft Text Driver (*.txt;
*.csv)};Dbq="
&Server.Mappath("/" & ";Extensions=asc,csv,tab,txt;"
'DB_name="DBQ="+server.mappath("/crct.asa"+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Sql = "Select * From test.txt"
Set oRs = Server.CreateObject("ADODB.RecordSet"
oRs.Open Sql,oConn,1,1
Response.Write "<table border=1 width=400>"
Response.Write "<tr><td>编号</td><td>用户名</td><td>密码</td></tr>"
Do While Not oRs.Eof
Response.Write "<tr><td>"
& oRs(0) & "
</td><td>"
& oRs(1) & "
</td><td>"
& oRs(2) & "
</td></tr>"
oRs.MoveNext
Loop
Response.Write "</table>"
%>