CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Posts
    2

    Smile how to make connection of database in vb.net 2005?

    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

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: how to make connection of database in vb.net 2005?

    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..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Feb 2008
    Posts
    14

    Re: how to make connection of database in vb.net 2005?

    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.

  4. #4
    Join Date
    Mar 2008
    Posts
    2

    Re: how to make connection of database in vb.net 2005?

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured