hi there i m having problems how do i connect to database in vb.net

Recommended Answers

All 3 Replies

specify database that u want to use. sql server, access, mysql, oracle, etc..

how do i connect to0 an access database in vb.net

try this :
first you must made module to connect access to vb.net
add this following code in your module connected :

Module MyModule
    Public Function Conection() As OleDb.OleDbConnection
        Dim con As OleDb.OleDbConnection
        con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath.ToString & "\yourDatabaseName.mdb")
        Return con
        con = Nothing
    End Function
 End Module

after that you can call this module in your form code to connect with access db
ex :
Dim Connected = MyModule.Koneksi

then u can open connection (Connected .Open()) or close connection (Connected.close())

Hope this code helpfull

commented: yes +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.