daily pastebin goal
70%
SHARE
TWEET

CONEXAO.ASP

a guest May 10th, 2010 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%
  2. 'CONEXÃO SQL Server
  3. Const gpVersaoSistema = "Versão: 1.0"
  4. Const userName_imp="paulo"
  5. Const passWord_imp="alfa30"
  6. Const dataBaseName_imp="BD_atChamado"
  7. Const serverName_imp = "JESUS-2FAB328AB"
  8.  
  9.  
  10. Sub gpAbreConexao()
  11.         Dim strConn
  12.         Set session("ObjConn") = Server.CreateObject("ADODB.Connection")
  13.         strConn = "Provider=SQLOLEDB;Persist Security Info=False;User ID="&userName_imp&";Password="&passWord_imp&";Initial Catalog="&dataBaseName_imp&";Data Source="&serverName_imp
  14.         session("ObjConn").ConnectionString = strConn
  15.         On Error Resume Next
  16.         session("ObjConn").Open
  17.         session("ObjConn").CommandTimeout=3600
  18.         if Err <> 0 Then
  19.                 response.write "<font face=arial size=2 color=#000055>Ocorreu o seguinte Erro ao abrir o banco de dados : </font>" & "<font face=arial size=2 color=#FF0000>" & Err.Description & "</font>"
  20.         ELSE
  21.                 'response.write "<font face=arial size=2 color=#000055>conexão efetuado com sucesso : </font>" & "<font face=arial size=2 color=#FF0000>" & Err.Description & "</font>"
  22.         End if
  23.         On Error goto 0
  24.         Session("ConexaoAberta") = "Sim"
  25. End Sub
  26.  
  27. Sub gpFechaConexao()
  28.     session("ObjConn").close
  29.     Set session("ObjConn") = Nothing
  30.     session("ObjConn")=""
  31.     Session("ConexaoAberta")="Não"
  32. End sub
  33.  
  34. %>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top