服务器不能调用 Driver={Microsoft Text Driver (*.txt; *.csv)} ,检查了几个小时才发现asp调用这个驱动要 Internet 来宾帐户(IUSR_XXX)列出文件夹目录 的权限,比较奇怪的是调用 driver microsoft access driver .mdb只要IUSR_XXX的 读取/写入 权限。
<%
Dim Conn, rs
Set Conn = Server.CreateObject("ADODB.Connection")
' Set the Dbq portion of the string to the physical folder where your price files reside
Conn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=D:\web\web;" & _ '个人估计问题在这里,他要先列出里面的文件,而我们调用MDB这个路径是写死的,所以只要打开MDB文件,而不要历遍文件夹
"Extensions=asc,csv,tab,txt;" & _
"Persist Security Info=False"
Dim sql
sql = "SELECT * from web.csv"
'(implicit recordset creation through execute method)
set rs = conn.execute(sql)
Response.write "<Table><TR BGCOLOR=lightgrey><TH>商品编号</TH><TH>商品名称</TH><TH>商品短名称</TH><TH>单位</TH><TH>商品积分</TH></TR>"
While Not rs.EOF
'here we have stock price text file in format: Date High Low Close Volume
Response.Write "<TR bgcolor=lightblue><TD>" & rs(0) & "</TD><TD>" & rs(1) _
& "</TD><TD>" & rs(2) & "</TD><TD>" & rs(3) & "</TD><TD> " & rs(4) & "</TD></TR>"
rs.MoveNext
Wend
Response.write "</TABLE>"
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
Dim Conn, rs
Set Conn = Server.CreateObject("ADODB.Connection")
' Set the Dbq portion of the string to the physical folder where your price files reside
Conn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=D:\web\web;" & _ '个人估计问题在这里,他要先列出里面的文件,而我们调用MDB这个路径是写死的,所以只要打开MDB文件,而不要历遍文件夹
"Extensions=asc,csv,tab,txt;" & _
"Persist Security Info=False"
Dim sql
sql = "SELECT * from web.csv"
'(implicit recordset creation through execute method)
set rs = conn.execute(sql)
Response.write "<Table><TR BGCOLOR=lightgrey><TH>商品编号</TH><TH>商品名称</TH><TH>商品短名称</TH><TH>单位</TH><TH>商品积分</TH></TR>"
While Not rs.EOF
'here we have stock price text file in format: Date High Low Close Volume
Response.Write "<TR bgcolor=lightblue><TD>" & rs(0) & "</TD><TD>" & rs(1) _
& "</TD><TD>" & rs(2) & "</TD><TD>" & rs(3) & "</TD><TD> " & rs(4) & "</TD></TR>"
rs.MoveNext
Wend
Response.write "</TABLE>"
rs.close
set rs = nothing
conn.close
set conn = nothing
%>