web 2.0

How to use ASP & CSV & ADO insert record (Driver={Microsoft Text Driver (*.txt; *.csv)})

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

ASP & CSV insert record with Ado

ASP & CSV insert record with Ado

.
.
.
Download this script.
Download

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

Leave a Reply

You must be logged in to post a comment.