CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: database?

  1. #1
    Join Date
    May 2007
    Posts
    148

    database?

    Hi,

    I have VB.net 2003 standard and have no DB hookup like in vb.nt professional I believe. I want to connect to a database.

    is it still possible to connect to a mysql DB or old access DB with code in the standard version of VB?

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: database?

    Yes it is possible. Just use the System.Data namespace.

  3. #3
    Join Date
    May 2007
    Posts
    148

    Re: database?

    Hi,

    Could I have an example of what you code to connect to a access database with using vb.net 2003 standard (no DB controls)?

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: database?

    Quote Originally Posted by jagguy
    Hi,

    Could I have an example of what you code to connect to a access database with using vb.net 2003 standard (no DB controls)?
    Take a look at this
    http://visualbasic.about.com/od/lear.../aa050303a.htm

  5. #5
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: database?

    Connectin to Access Database and fetching data to dataGridView.
    Code:
        Dim conn As OleDb.OleDbConnection
        Dim adapter As OleDb.OleDbDataAdapter
        Dim dt As DataTable
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\attendence.mdb;Persist Security Info=False")
    
            adapter = New OleDb.OleDbDataAdapter("SELECT rno,name FROM student", conn)
    
            dt = New DataTable("Student")
            adapter.Fill(dt)
    
            DataGridView1.DataSource = dt
        End Sub
    Link

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