Nelson Cruz Posted December 26, 2011 Report Share Posted December 26, 2011 '********************************************************************** ' Visual Basic ActiveX Script '************************************************************************ Function Main() 'Dim conexao, registro, cntServidor set conexao = CreateObject("ADODB.Connection") set registro = CreateObject("ADODB.Recordset") set rs_historico = CreateObject("ADODB.Recordset") cntServidor = "Network Library=dbnmpntw;SERVER=RJ7399SR003;uid=suporte;pwd=adm7399;driver={SQL Server};database=SUPORTE;" conexao.CommandTimeout = 0 conexao.Open cntServidor tSQL = "SELECT H.cod AS cod_hist, C.cod AS cod_cham, S.nome AS situacao, C.descricao AS descr_cham, RIGHT(C.logn_inc, 7) AS logn_inc, ABRIU.NOME AS nme_inc, RIGHT(C.logn_alt, 7) AS logn_alt, ALTEROU.NOME AS nme_alt, H.descricao AS resp_cham, RIGHT(C.logn_inc, 7) + '@mail.caixa' as email " tSQL = tSQL + "FROM EMPREGADOS ALTEROU " tSQL = tSQL + "RIGHT OUTER JOIN tbChamados C " tSQL = tSQL + "INNER JOIN EMPREGADOS ABRIU ON RIGHT(C.logn_inc, 7) = ABRIU.LOGIN " tSQL = tSQL + "RIGHT OUTER JOIN tbSituacao S " tSQL = tSQL + "RIGHT OUTER JOIN tbHistorico H ON S.cod_sit = H.cod_sit ON C.cod = H.codcham ON ALTEROU.LOGIN = RIGHT(H.logn_inc, 7) " tSQL = tSQL + "WHERE (H.dt_envio_pendente IS NULL) and (H.cod_sit in(3))" registro.open tSQL, conexao, 3, 3 Set objConfig = CreateObject("CDO.Configuration") With objConfig.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.correio.caixa" .Update End With ' Instantiate the CDO Message object. Set objMail = CreateObject("CDO.Message") If registro.EOF then Else Do while not registro.EOF email_destino = registro("email") '=======================Mensagem do envio de email================================ 'conteúdo da mensagem strBody = "<html><head>" & vbCrLf & vbCrLf & _ "</head><body> <b>MENSAGEM AUTOMATICA - SIATEL -CERAT/RJ</b>" & vbCrLf & _ "<br><br>NRº DO CHAMADO: " & registro("cod_cham") &"" & _ "<br><br>SITUAÇÃO: " & registro("situacao") &"" & _ "<br><br>DESCRIÇÃO: " & registro("descr_cham") & "" & _ "<br><br>RESPOSTA: " & registro("resp_cham") & "" & _ "<br><br>RESPONDIDO POR: " & registro("logn_alt") &" - " & registro("nme_alt") & "" & _ "<br><br>EQUIPE - SUPORTE TECNOLÓGICO." strBody = strBody & "</body></html>" With objMail Set .Configuration = objConfig .From = "ceratrj03@mail.caixa" .To = email_destino .CC = "c077237@mail.caixa,p606747@mail.caixa" .Subject = "MSG AUTOMATICA - SIATEL - CERAT/RJ" .HtmlBody = strBody .Send End With tSQL = "select dt_envio_pendente from tbhistorico where cod = " & registro("cod_hist") rs_historico.open tSQL, conexao, 3, 3 rs_historico("dt_envio_pendente") = now() rs_historico.update rs_historico.close registro.movenext loop End if registro.close set registro = nothing set rs_historico = nothing SET objMail = nothing Main = DTSTaskExecResult_Success End FunctionEssa DTS está dando o seguinte erro. "Falha na conexão do transporte com o servidor". erro na linha 66alguém poderia me ajudar com esse problema?? Quote Link to comment Share on other sites More sharing options...
0 fulvio Posted January 2, 2012 Report Share Posted January 2, 2012 Bom dia Nelson, Verifique se os protocolos de conexão do sql estão ativos e funcionantes. Quote Link to comment Share on other sites More sharing options...
Question
Nelson Cruz
Essa DTS está dando o seguinte erro. "Falha na conexão do transporte com o servidor". erro na linha 66
alguém poderia me ajudar com esse problema??
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.