难道无人能解? ASP(非NET)中读取CSV文件的方法
db= "DBQ= "+CsvPath + ";DRIVER= {Microsoft Text Driver (*.txt; *.csv)};Extensions=asc,csv,tab,txt;Persist Security Info=False; "
set rs=Server.CreateObject( "ADODB.Recordset ")
sql= "select * from noname.csv "
rs.open sql,db,1,1
连网页都打不开,KAO
------解决方案--------------------set conn=Server.CreateObject( "ADODB.connection ")
db= "DBQ= "+CsvPath + ";DRIVER= {Microsoft Text Driver (*.txt; *.csv)};Extensions=asc,csv,tab,txt;Persist Security Info=False; "
conn.open db
set rs=Server.CreateObject( "ADODB.Recordset ")
sql= "select * from noname.csv "
rs.open sql,conn,1,1
试试
另外把IE的显示友好HTTP错误信息去掉就可以显示出错误信息
------解决方案-------------------- <%
CsvPath = server.mapPath( "\test ")
set conn=Server.CreateObject( "ADODB.connection ")
db = "Dbq= " & CsvPath & ";Driver={Microsoft Text Driver (*.txt; *.csv)};Extensions=asc,csv,tab,txt; "
conn.open db
set rs=Server.CreateObject( "ADODB.Recordset ")
sql= "select * from a.csv "
rs.open sql,conn,1,1
conn.close
%>
IE "工具 "菜单-> "Internet选项 "-> "高级 "标签
下拉找到 "显示友好HTTP错误信息 "设为未选中状态,按确定....
------解决方案--------------------用OLEDB连接字符串
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & csvPath & ";Extended Properties= "text;HDR=Yes;FMT=Delimited ";
HDR=Yes表示第一行是列名