Data Access Class
Hi All, This is code for a class for data access this class helps you to setup connections to data base…..!
Public Class DataAccess
Public StrConnection As String = "Server=.;Database=TMS;Integrated Security=True"
Public ObjCon As New SqlConnection
Sub openDB()
Try
ObjCon.ConnectionString = StrConnection
If (ObjCon.State = ConnectionState.Closed) Then
ObjCon.Open()
Public StrConnection As String = "Server=.;Database=TMS;Integrated Security=True"
Public ObjCon As New SqlConnection
Sub openDB()
Try
ObjCon.ConnectionString = StrConnection
If (ObjCon.State = ConnectionState.Closed) Then
ObjCon.Open()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Sub closeDB()
Try
If (ObjCon.State = ConnectionState.Open) Then
ObjCon.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Sub closeDB()
Try
If (ObjCon.State = ConnectionState.Open) Then
ObjCon.Close()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
- Posted in: ADO.Net 2.0
Recent Comments