How to use ASP & CSV & ADO insert record (Driver={Microsoft Text Driver (*.txt; *.csv)}) This is learn/tutorial asp developers how to using ASP script and CSV insert record with Ado
ShotDev Focus:
- ASP & CSV insert record with Ado
Example
asp_csv_insert.asp
<%Option Explicit%> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim Conn,strSQL,objExec 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 = "" strSQL = strSQL &"INSERT INTO customer.csv " strSQL = strSQL &"(CustomerID,Name,Email,CountryCode,Budget,Used) " strSQL = strSQL &"VALUES " strSQL = strSQL &"('C005','Mr.Weerachai Nukitram','webmaster@shotdev.com' " strSQL = strSQL &",'TH','200000','100000') " Set objExec = Conn.Execute(strSQL) If Err.Number = 0 Then Response.write("Save Completed.") Else Response.write("Error Save ["&strSQL&"] ("&Err.Description&")") End If Conn.Close() Set objExec = Nothing Set Conn = Nothing %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_csv_insert.asp
Screenshot