Imports System.Data ,
GHD Hair Straightener
Imports System.Data.SqlClient
Imports System.ComponentModel
Public Class DataBase
Implements IDisposable
Private SqlConn As SqlConnection
Public Shared sConn As String = = 30; Data Source = ServerName
Public Sub Dispose () Implements System.IDisposable.Dispose
Dispose (True)
GC.SuppressFinalize (True)
End Sub
Protected Sub Dispose (ByVal disposing As Boolean)
If disposing True Then
Return
; End If
If SqlConn Is Nothing = False Then
SqlConn . Dispose ()
SqlConn = Nothing
End If
End Sub
Public Sub Open ()
If SqlConn Is Nothing = True Then
; SqlConn = New SqlConnection (DataBase.sConn)
SqlConn.Open ()
End If
End Sub
Public Sub Close ()
If SqlConn Is Nothing = False Then
; SqlConn.Close ()
End If
End Sub
Public Function GetDataTables () As Collections.ArrayList
Me.Open ()
; Dim t As New Collections.ArrayList
Dim dt As DataTable
dt = Me.SqlConn.GetSchema (; If row (; t.Add (row (br> Next row
Return t
End Function
Public Function RunSelectSQL (ByVal sSQLString As System.String) As DataView
Me.Open ()
; Dim SqlDS As DataSet = New DataSet
Dim SqlDA As SqlDataAdapter = New SqlDataAdapter (sSQLString,
GHD Diamond Flag 2011, Me.SqlConn)
SqlDA.Fill (SqlDS)
Return SqlDS.Tables (0). DefaultView
End Function
Public Function RunDelOrInsSQL (ByVal sSQLString As System.String)
Me.Open ()
; Dim SqlComm As SqlCommand = New SqlCommand (sSQLString,
GHD, Me.SqlConn)
SqlComm.ExecuteNonQuery ()
Return 0
End Function
End Class