zoukankan      html  css  js  c++  java
  • asp 连接 csv,读取 csv 文件

    <%Option Explicit%>
    <html>
    <head>
    <title>ShotDev.Com Tutorial</title>
    </head>
    <body>
    <%
    Dim Conn,objRec,strSQL
    Set Conn = Server.Createobject("ADODB.Connection")
    Conn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
    "Dbq=" & Server.MapPath("shotdev/") & ";Extensions=asc,csv,tab,txt;Persist Security Info=False"
    
    strSQL = "SELECT * FROM customer.csv "
    Set objRec = Conn.Execute(strSQL)
    %>
    <table width="600" border="1">
    <tr>
    <th width="91"> <div align="center">CustomerID </div></th>
    <th width="98"> <div align="center">Name </div></th>
    <th width="198"> <div align="center">Email </div></th>
    <th width="97"> <div align="center">CountryCode </div></th>
    <th width="59"> <div align="center">Budget </div></th>
    <th width="71"> <div align="center">Used </div></th>
    </tr>
    <%
    If Not objRec.EOF Then
    objRec.MoveFirst
    While Not objRec.EOF
    %>
    <tr>
    <td><div align="center"><%=objRec.Fields(0).Value%></div></td> <!--objRec.Fields("CustomerID").Value -->
    <td><%=objRec.Fields(1).Value%></td> <!--objRec.Fields("Name").Value -->
    <td><%=objRec.Fields(2).Value%></td> <!--objRec.Fields("Email").Value -->
    <td><div align="center"><%=objRec.Fields(3).Value%></div></td> <!--objRec.Fields("CountryCode").Value -->
    <td align="right"><%=objRec.Fields(4).Value%></td> <!--objRec.Fields("Budget").Value -->
    <td align="right"><%=objRec.Fields(5).Value%></td> <!--objRec.Fields("Used").Value -->
    </tr>
    <%
    objRec.MoveNext
    Wend
    End IF
    %>
    <%
    objRec.Close()
    Conn.Close()
    Set objRec = Nothing
    Set Conn = Nothing
    %>
    </table>
    </body>
    </html>

    来源:http://www.shotdev.com/asp/asp-csv/asp-csv-odbc/

  • 相关阅读:
    《P3953 [NOIP2017 提高组] 逛公园》
    《P4180 [BJWC2010]严格次小生成树》
    《济南icpc补题》
    《levil的因子和》
    《洛谷P2704 [NOI2001]炮兵阵地》
    《Codeforces Round #689 (Div. 2, based on Zed Code Competition)》
    《2174: Leapin' Lizards》
    《3820: Revenge of Fibonacci 》
    马拉车求最长回文子串
    二分训练
  • 原文地址:https://www.cnblogs.com/personnel/p/13631193.html
Copyright © 2011-2022 走看看