954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

connecting to a dataabase in vb.net

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

tau
Newbie Poster
2 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

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

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

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

tau
Newbie Poster
2 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

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())

OK.
Hope this code helpfull

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You