Created
March 9, 2020 20:01
-
-
Save kllaudyo/d94d411b3836f4e4cb02a022b42bae21 to your computer and use it in GitHub Desktop.
Split vbcrlf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--#include file="../util/adovbs.inc"--> | |
<!--#include file="../util/un_util_objetos.asp"--> | |
<% | |
sFileName = "SAP_99999.html" | |
Set oFileSystem = Server.CreateObject("Scripting.FileSystemObject") | |
Set oFile = oFileSystem.OpenTextFile(Server.MapPath(sFileName), 1, True) | |
sMailMsg = "" | |
Do Until oFile.AtEndOfStream | |
sMailMsg = sMailMsg & oFile.ReadLine & vbcrlf | |
Loop | |
Set oFile = Nothing | |
Set oFileSystem = Nothing | |
aRows = Split(sMailMsg, vbcrlf) | |
For i=0 To UBound(aRows) | |
sBlock = aRows(i) & " " | |
Response.Write "<p>'" & sBlock & "'</p>" | |
If i = 0 Then | |
Set oRs = CN_Banco.Execute("SELECT SQ_EMAIL_SAP.NEXTVAL FROM DUAL") | |
iId = oRs(0) | |
Set oRs = Nothing | |
sSQL = "" | |
sSQL = sSQL & "INSERT INTO EMAIL_SAP " | |
sSQL = sSQL & "(TE_CORPO, ID_EMAIL_SAP, NM_DE, TE_ASSUNTO, DT_EMAIL) " | |
sSQL = sSQL & "VALUES " | |
sSQL = sSQL & "(?, ?, '[email protected]', 'TESTE', TO_DATE('09/03/2020','DD/MM/YYYY')) " | |
Else | |
sSQL = "" | |
sSQL = sSQL & "UPDATE EMAIL_SAP " | |
sSQL = sSQL & "SET TE_CORPO = TE_CORPO || ? " | |
sSQL = sSQL & "WHERE ID_EMAIL_SAP = ? " | |
End If | |
Set oCmd = Server.CreateObject("ADODB.Command") | |
oCmd.ActiveConnection = CN_Banco | |
oCmd.CommandType = adCmdText | |
oCmd.CommandText = sSQL | |
oCmd.Parameters.Append oCmd.createParameter("@Corpo", adLongVarChar, adParamInput, 4000, sBlock) | |
oCmd.Parameters.Append oCmd.createParameter("@Id", adBigInt, adParamInput, , iId) | |
oCmd.Execute | |
Set oCmd = Nothing | |
Next | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment