sexta-feira, 5 de fevereiro de 2021

[ASP 2.0] Crie sua função FileCopy

 <%

Function FileCopy(byVal source, byVal destination)

                Dim objFSO, objToCopy, boolErr, strErrDesc

                On Error Resume Next

                Set objFSO = Server.CreateObject("scripting.filesystemobject")

                if instr( right( source, 4 ), "." ) then

                                Set objToCopy = objFSO.GetFile(source)

                else

                                Set objToCopy = objFSO.GetFolder(source)

                end if

                objToCopy.Copy destination

                if Err Then

                               boolErr = True

                               strErrDesc = Err.Description

                end if

                Set objToCopy = Nothing

                Set objFSO = Nothing

                On Error GoTo 0

                if boolErr then Err.Raise 5104, "FileCopy Statement", strErrDesc

End Function

 

 

ServArqDOWN = "\\ServidorIIS\wwwroot\SeuSistema\Transf\"

ArquivoOrigem = "\\ServidorDeArquivos\pasta1\pasta2\pasta3\arquivo.doc"       ‘<--- Aqui poderia ser atribuído um campo de recordSet

cont = 1

letra = "."

While Left(Right(ArquivoOrigem, cont), 1) <> "\"

    letra = Left(Right(ArquivoOrigem, cont), 1)

    cont = cont + 1

Wend

sNomeArq = Right(ArquivoOrigem, cont - 1)

sNomeArqCompleto = ServArqDOWN & sNomeArq

 

FileCopy ArquivoOrigem, sNomeArqCompleto

 

Response.Write("<a href=""Transf/" & sNomeArq & Chr(34) & ">Clique Aqui para fazer download do Arquivo</a>")

%>

[SQL] COLLATE

create table #aaa
(
       PALAVRA1  varchar(max),
       PALAVRA2  varchar(max)
)

insert into #aaa(PALAVRA1, PALAVRA2) values ('A','A')
insert into #aaa(PALAVRA1, PALAVRA2) values ('ã','A')
insert into #aaa(PALAVRA1, PALAVRA2) values ('A','a')
insert into #aaa(PALAVRA1, PALAVRA2) values ('Aa','aa')


select *, case when  PALAVRA1 collate Latin1_General_CI_AI = PALAVRA2 then 'igual' else 'diferente' end as c from #aaa

select *, case when  PALAVRA1 collate Latin1_General_CS_AS = PALAVRA2 then 'igual' else 'diferente' end as c from #aaa

drop table #aaa

[JS] Reload em um frame

parent.document.getElementById('nome_do_frame').contentWindow.location.reload(true);

terça-feira, 2 de fevereiro de 2021

USE DATABASE comando

/* MySQL */
USE MYDATBASENAME; 

/* SQL-Server */
USE
[
MYDATBASENAME];

/* OracleDB */
ALTER SESSION SET current_schema = 'MYDATBASENAME';


[ASP 2.0] Crie sua função FileCopy

  <% Function FileCopy(byVal source, byVal destination)                 Dim objFSO, objToCopy, boolErr, strErrDesc                 On Err...