Hello All, I'm about to convert my connection from MS-Access database to SQL server database which i create but i don't know how to convert my connection code below that i used to connect to MS Access DB. Please can anyone advice me to what part of code should i remove and what should i add to help connect it to SQL server DB. Thank you all inadvance and sorry to bother you all with my issue.
Editing: Try to connect to SQL server 2008.
Code:
On Error GoTo OpenLocalDB_Error
Screen.MousePointer = vbHourglass
dbPath = GetSetting(App.Title, "Settings", "Path")
'loads the database path, if there isnt one it loads D:
' If dbPath = "" Then
SaveSetting App.Title, "Settings", "Path", "D:" ' For multi application and one database add : "\\BRSS-PC\"
dbPath = GetSetting(App.Title, "Settings", "Path")
'' End If
Screen.MousePointer = vbHourglass
RecPath = dbPath & "\Reports\"
'uses dbPath to build database path
g_strDBName = dbPath & "\BarqCell Data\DSS.mdb;Jet " & "OLEDB:Database Password=brss"
'creates a new databse conection and sets the conection string
Set dbContact = New ADODB.Connection
Constring = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & g_strDBName
dbContact.ConnectionString = Constring
'Opens the database conection
dbContact.Open