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
Printable View
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
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..
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.
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