Click to See Complete Forum and Search --> : how to make connection of database in vb.net 2005?


buzzup
March 18th, 2008, 06:38 AM
hi all,
I am vb.net 2005 beginner. so please tell me how to do connection with vb.net 2005. Please tell me from startup.
Thanks

GremlinSA
March 18th, 2008, 07:50 AM
Hi buzzup

It all depends on what DB you plan to connect to ?? Is it MySQL ,MSSQL, SQLServer, Access ....

Tell us more of what your planning and then we can help you more..

Gremmy..

bflosabre91
March 18th, 2008, 08:56 AM
it will be a lot quicker for you if you just google vb.net and whatever type of DB you will be using. There are tons of tutorials out there for every type of DB.

jw38125
March 29th, 2008, 04:09 PM
Here is sample code: Caution - I code any variable starting with g is a global variable...

Imports System.Data
Imports System.Data.OleDb

Public Class frmCDLib

Private Sub frmCDLib_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
gstrDBPath = "C:\Databases\DigitalLibrarian.mdb"
gstrProvider = "PROVIDER=Microsoft.jet.OLEDB.4.0;Data Source = " & gstrDBPath
Dim ConnectionString As String = gstrProvider
Dim Connection As OleDbConnection = New OleDb.OleDbConnection(ConnectionString)
Connection.Open()
MsgBox("Database Opened Successfully")
' Go do your thing here------>
Connection.Close()
MsgBox("Database Successfully Closed")
End Sub


End Class