Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.24 KB | None | 0 0
  1. ' * Desenvolvido por Antonio Carlos
  2. ' * Data: 18/06/2011
  3. ' * Hora: 11:38
  4. ' * Classe de Conexao com Banco de Dados
  5. ' * FireBird
  6.  
  7. #Region "Importação de Name Spaces"
  8.  
  9.     imports System
  10.     imports System.Data
  11.     imports System.Windows.Forms
  12.     imports FirebirdSql.Data.FirebirdClient
  13.  
  14. #End Region
  15.  
  16. Class bdComn
  17.     Function abrirbanco() As FbConnection
  18.            
  19.            
  20.             Dim strconexao as String = "User=SYSDBA;Password=masterkey;Database=data_base.fdb;DataSource=localhost; Port=3050;Dialect=3; Charset=NONE;Role=;Connection lifetime=15;Pooling=true; MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;"
  21.             Dim  cn As FbConnection = New FbConnection(strconexao)
  22.            
  23.             Try
  24.                
  25.                 cn.open()
  26.                 if cn.State=ConnectionState.Open then
  27.                    messagebox.Show("Conexão foi aberta com sucesso !!!","Sistema Emissor")
  28.                 End If
  29.                
  30.                 Return cn
  31.                                                
  32.             Catch e As System.Exception
  33.                 Throw e
  34.             End Try
  35.         End Function
  36. '--------------------------------------------------------------------------
  37.         Public Sub fecharbanco(cn As FbConnection )
  38.             If cn.State = ConnectionState.Open Then
  39.                cn.Close()  
  40.             End If
  41.         End Sub
  42. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement