Results 1 to 6 of 6

Thread: MS Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    6

    Arrow MS Access

    How can I display a MS Access db in VB.NET?

  2. #2
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    vb_Tux,

    the answer to that question has filled many books in bookstores around the world.

    can you be more specific? like, do you wish to connect to an access db? add records? delete, update records? reports? grids?
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

  3. #3
    New Member
    Join Date
    Feb 2003
    Posts
    2
    I have a .mdb file, how would I go about getting the contents of that? (displaying it into a data grid to be specific)

  4. #4
    Member
    Join Date
    Dec 2002
    Location
    NY, USA
    Posts
    52
    VB Code:
    1. 'Create DataSet (thru adapter fill ds from table)
    2.  
    3. Imports System.Data.Oledb
    4.  
    5. Public Class Form1
    6.     Inherits System.Windows.Forms.Form
    7.  
    8.     'form level declarations
    9.     Dim cn As OleDbConnection
    10.     Dim sConn As String
    11.     Dim ds As DataSet
    12.     Dim da As OleDbDataAdapter
    13.  
    14.  
    15.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    16.         Dim sDBNAme As String = "c:\TestDB\TestDB.mdb"
    17.         Dim sSQL As String = "select * from PRQ"
    18.         sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDBNAme & ";Persist Security Info=False"
    19.         cn = New OleDbConnection(sConn)
    20.  
    21.         ds = New DataSet()
    22.         da = New OleDbDataAdapter(sSQL, cn)
    23.         da.Fill(ds, "TableName")
    24.             'Bind dataGrid to DataSet
    25.             dg.DataSource = ds.Tables("TableName")
    26.  
    27.             'Clean memory (Like Setting to Nothing)
    28.             ds.Dispose()
    29.             da.Dispose()
    30.  
    31.     End Sub
    32. End CLass
    Iouri Boutchkine

  5. #5
    New Member
    Join Date
    Feb 2003
    Posts
    2
    Oh thanks Your solved my problem, although I feel I hi-jacked vb_TuX's thread

  6. #6
    Addicted Member Zealot's Avatar
    Join Date
    Jul 2002
    Location
    Lisboa, Portugal
    Posts
    206
    That example is pretty good for beginners, thanks Iouri!

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