<%
vgood=0
vbad=0
Set csv = Server.CreateObject("ADODB.Connection")
csv.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("./database/") & ";" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited"""
Set acc = Server.CreateObject("ADODB.Connection")
acc.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("./database/db1.mdb") & ";"
Set accRS = Server.CreateObject("ADODB.RecordSet")
accRS.Open "tbl_clients", acc, 3, 3 ' adOpenStatic, adLockOptimistic
Set csvRS = csv.Execute("SELECT * FROM db1.csv")
accRS.AddNew ' do this before the loop
Do Until csvRS.EOF
accRS("custname") = csvRS("Name")
accRS("custemail") = csvRS("Email")
accRS("custmemtype") = csvRS("MembershipType")
accRS("custmemgroup") = csvRS("Interest")
On Error Resume Next
accRS.Update
If Err.Number > 0 Then
vbad=vbad+1
If InStr(Err.Description, "duplicate value") = 0 Then
'Response.Write "UNEXPECTED error:" & Err.Number & ", " & Err.Description
Response.End
End If
' skip doing the addNew if it was duplicate...use prior newly added record
Else
' only add another record if no error at all
accRS.AddNew
vgood=vgood+1
End If
On Error GoTo 0
csvRS.MoveNext
Loop
accRS.Close
csvRS.Close
%>