I'm trying to create a module so I can make the connection string public and avialble from any form. how do I do this in vb.net? in vb6 I would simply call strcn as my active connection.
any help would be appreciated
Imports System.Data.OleDb
Imports System.Data
Module ConSQL
Public Sub ConnectDB()
Dim cn As OleDb.OleDbConnection
Dim strcn As String = _
"Provider=sqloledb;" & _
"Data Source=server;" & _
"Initial Catalog=DB;" & _
"User Id=uid;" & _
"Password=pwd"
cn = New OleDb.OleDbConnection(strcn)
cn.Open()
End Sub
End Module
any help would be appreciated
Imports System.Data.OleDb
Imports System.Data
Module ConSQL
Public Sub ConnectDB()
Dim cn As OleDb.OleDbConnection
Dim strcn As String = _
"Provider=sqloledb;" & _
"Data Source=server;" & _
"Initial Catalog=DB;" & _
"User Id=uid;" & _
"Password=pwd"
cn = New OleDb.OleDbConnection(strcn)
cn.Open()
End Sub
End Module