Public NotInheritable Class DBConn
Public Shared strConn As String = "Server =.\SQLEXPRESS;Database=ComP;Integrated Security=True"
End Class
ฟอร์มเชื่อมต่อฐานข้อมูล Code (VB.NET)
Dim strConn As String = DBConn.strConn
Conn = New SqlConnection
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strConn
.Open()
End With