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

Thread: VB access database means

  1. #1

    VB access database means

    Hello, there:

    I noticed at least three ways of manupilate the database access:

    1. db = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\datas.mdb")
    rs = db.OpenRecordSet("table")

    2. Use ADO object. In a new project, select menu "project"->
    "Reference"->"Microsoft Active Data Object 2.5 liberary".

    Private cn As ADODB.Connection
    Private rs As ADODB.Recordset

    set cn = new ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source= c:\my documents\DB1.mdb"
    Set rs = New ADODB.Recordset
    rs.Open "tbl_master", cn, adOpenKeyset, adLockPessimistic, adCmdTable

    3. Dim db As Database
    Dim rs As Recordset
    set db = OpenDatabase("C:\whatever.mdb")
    set rs = db.OpenRecordSet(sql query)

    I'm a beginner. Anyone here can tell me which is the best, or any setback of each means? It seemes to me that the third one is the simplest, but I heard the ADO access is the most efficient.
    Help wanted!!

    thank you all

  2. #2
    Join Date
    Aug 2002
    Hi !

    All ways are good. You have to look up what you want to do.

    If you have linked Tables and want to get the Recordcount, you will have problems with 2, with 1 and 3 you will get it.

    If you want to retireve a Recordset from a Form, DAO is your choice.

    If you want to do any SQL Manipulation ADO is good.

    At the moment a Recordset in a Form is a DAO Recordset. It is not certain that Microsoft will develop DAO in the future. So it can be , that in a future Version of Access every Recordset will be an ADO.
    Best regards

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)