web 2.0

How to use ASP & CSV and ADO (Provider=Microsoft.Jet.OLEDB.4.0; Data Source)

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

  1. <%Option Explicit%>  
  2. <html>  
  3. <head>  
  4. <title>ShotDev.Com Tutorial</title>  
  5. </head>  
  6. <body>  
  7. <%  
  8. Dim Conn,objRec,strSQL  
  9. Set Conn = Server.Createobject("ADODB.Connection")  
  10. Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.MapPath("shotdev/")& "" & _  
  11. ";Extended Properties='TEXT;HDR=Yes;FMT=Delimited;Format=Delimited(,)'"  
  12.   
  13. strSQL = "SELECT * FROM customer.csv "  
  14. Set objRec = Conn.Execute(strSQL)  
  15. %>  
  16. <table width="600" border="1">  
  17. <tr>  
  18. <th width="91"> <div align="center">CustomerID </div></th>  
  19. <th width="98"> <div align="center">Name </div></th>  
  20. <th width="198"> <div align="center">Email </div></th>  
  21. <th width="97"> <div align="center">CountryCode </div></th>  
  22. <th width="59"> <div align="center">Budget </div></th>  
  23. <th width="71"> <div align="center">Used </div></th>  
  24. </tr>  
  25. <%  
  26. If Not objRec.EOF Then  
  27. objRec.MoveFirst  
  28. While Not objRec.EOF  
  29. %>  
  30. <tr>  
  31. <td><div align="center"><%=objRec.Fields(0).Value%></div></td> <!--objRec.Fields("CustomerID").Value -->  
  32. <td><%=objRec.Fields(1).Value%></td> <!--objRec.Fields("Name").Value -->  
  33. <td><%=objRec.Fields(2).Value%></td> <!--objRec.Fields("Email").Value -->  
  34. <td><div align="center"><%=objRec.Fields(3).Value%></div></td> <!--objRec.Fields("CountryCode").Value -->  
  35. <td align="right"><%=objRec.Fields(4).Value%></td> <!--objRec.Fields("Budget").Value -->  
  36. <td align="right"><%=objRec.Fields(5).Value%></td> <!--objRec.Fields("Used").Value -->  
  37. </tr>  
  38. <%  
  39. objRec.MoveNext  
  40. Wend  
  41. End IF  
  42. %>  
  43. <%  
  44. objRec.Close()  
  45. Conn.Close()  
  46. Set objRec = Nothing  
  47. Set Conn = Nothing  
  48. %>  
  49. </table>  
  50. </body>  
  51. </html>  

Create a asp file and save to path root-path/myasp/

Run
http://localhost/myasp/asp_ado_csv.asp

Screenshot

ASP & CSV Ado Oledb

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (3 votes, average: 1.00 out of 10)
Loading ... Loading ...

One Response to “How to use ASP & CSV and ADO (Provider=Microsoft.Jet.OLEDB.4.0; Data Source)”

  1. 2competent…

Leave a Reply

You must be logged in to post a comment.