conn.asp 606 B

1234567891011121314151617181920212223242526
  1. <%Session.CodePage=65001%>
  2. <%
  3. On Error Resume Next
  4. Dim Conn
  5. Sub OpenConn()
  6. On Error Resume Next
  7. Dim ConnStr
  8. ConnStr = "DRIVER={PostgreSQL ODBC Driver(UNICODE)}; SERVER=127.0.0.1; port=5432; DATABASE=stoneu; UID=postgres; PWD=stoneu_4k;"
  9. Set Conn = Server.CreateObject("ADODB.Connection")
  10. Conn.open ConnStr
  11. If Err Then
  12. Err.Clear
  13. Set Conn = Nothing
  14. Response.Write "Connection Error!"
  15. Response.End
  16. End If
  17. End Sub
  18. Sub CloseConn()
  19. On Error Resume Next
  20. If IsObject(Conn) Then
  21. Conn.Close
  22. Set Conn = Nothing
  23. End If
  24. End Sub
  25. %>