Solved
Implement a function to connect to a DB
Posted on 2006-11-28
using vb.net I would like to implement a function that would connect my project to a MS Access database.
using the upgrading tool VB6 to VB.net from my software I got this
Public function ADO_Connect() as boolean
dim connSDB as new adodb.connection
'error handler to exit function and return false if error occurs
on error goto Err_handler
ADO_Connect= true
connSDB.open "Driver={Microsoft Access Driver (*.mdb)}:DBQ=Path to the database"
Exit function
'label for error handler
Err_handler:
ADO_Connect=false
End function
The ADO_Connect procedure will be added to the form load event, and in case the connection failed to be established an message box would be displayed and the form unload