%
' Comersus BackOffice
' e-commerce ASP Open Source
' CopyRight Rodrigo S. Alhadeff, Comersus
' 2004
' http://www.comersus.com
%>
Import Customers
<%
on error resume next
dim mySQL, conntemp, rstemp
mySQL="SELECT name, lastName, customerCompany, phone, email, address, zip, stateCode, state, city, countryCode, shippingName, shippingLastName, shippingaddress, shippingcity, shippingStateCode, shippingState, shippingCountryCode, shippingZip FROM Customers"
call getFromDatabase(mySQL, rstemp, "comersus_backoffice_importUtilityForm.asp")
'check if the form was loaded first
if request("itemsbox")="" then
%>
1. Select the fields to import
2. Create a CSV text file customers.txt in BackOffice folder respecting the fields order and separated with ,
3. Click on Import button
<%else%>
Importing /backofficelite/customers.txt with record format:
<%
pFields = replace(replace(request("itemsbox"),chr(13),","),chr(10),"")
do while instr(pFields,",")<>0
pIndexField=mid(pFields,1,instr(pFields,",")-1)
pFields=mid(pFields,instr(pFields,",")+1)
for each whatever in rstemp.fields
if whatever.name=rtrim(ltrim(pIndexField)) then
'if (whatever.type=202 or whatever.type=203) then
' response.write "'"&pIndexField&"',"
'else
response.write pIndexField&","
'end if
else
end if
next
loop
pIndexField=trim(pFields)
pFields = replace(replace(request("itemsbox"),chr(13),","),chr(10),"")
for each whatever in rstemp.fields
if whatever.name=rtrim(ltrim(pIndexField)) then
if (whatever.type=202 or whatever.type=205) then
response.write "'"&pIndexField&"'"
else
response.write pIndexField
end if
else
end if
next
%>
If you are ready to begin ">click here...
<%end if%>
<%call closeDb()%>