Dim objFSO,oInStream,sRows,arrRows
Dim sFileName
sFileName = "檔案路徑/test.csv"
'*** Create Object ***'
Set objFSO = CreateObject("Scripting.FileSystemObject")
'*** 確認檔案是否存在 ***'
If Not objFSO.FileExists(Server.MapPath(sFileName)) Then
Response.write("File not found.")
Else
'*** 讀取檔案 ***'
Set oInStream = objFSO.OpenTextFile(Server.MapPath(sFileName),1,False)
Do Until oInStream.AtEndOfStream
'重設Email_Item,Email_Item為所要出貨之商品名稱'
Email_Item = ""
sRows = oInStream.readLine
arrRows = Split(sRows,",")
'個別寫入配送紀錄表' delivery_num=arrRows(1);Shipped_type=arrRows(4);Shipped_Date=arrRows(2)
Response.write "Oid 在開頭="&arrRows(0)&"<br/>"
Response.write "Shipped_Date 在開頭="&arrRows(2)&"<br/>"
Response.write "Shipped_type 在開頭="&arrRows(4)&"<br/>"
Response.write "delivery_num 在開頭="&arrRows(1)&"<br/>"
Response.write "Cid 在開頭="&Cid&"<br/>"
call insert_shippments_by_transaction_id(arrRows(0),Cid,arrRows(1),arrRows(4),arrRows(2))
'將出貨物品之名稱組成一個字串'
items_sent = Split(arrRows(3), "|")
For I=0 to Ubound(items_sent)
If items_sent(i)<>"" then
Email_Item = Email_Item &""&items_sent(i)&"<br/>"
End If
Next
response.write "<br/>"
call get_mail_body_and_send(Email_Item,First_name,arrRows(2),Oid,arrRows(1),EMail)
Loop
'*** 關檔 ***'
oInStream.Close()
Set oInStream = Nothing
End IF
留言
張貼留言