How to use ASP & CSV and ADO (Provider=Microsoft.Jet.OLEDB.4.0; Data Source) This is learn/tutorial asp developers how to using ASP script and CSV Ado Oledb
ShotDev Focus:
- ASP & CSV Ado Oledb
Example
asp_ado_csv.asp
<%Option Explicit%> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim Conn,objRec,strSQL Set Conn = Server.Createobject("ADODB.Connection") Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPath("shotdev/")& "" & _ ";Extended Properties='TEXT;HDR=Yes;FMT=Delimited;Format=Delimited(,)'" 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>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_ado_csv.asp
Screenshot
2competent…
…