[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating DB Connection on load VB.NET to .mdb

Posted on 2009-04-07
5
Medium Priority
?
372 Views
Last Modified: 2013-11-26
I'm attempting to open a connection to an .mdb file via vb.net It seems pretty straight forward but can't seem to get it getting "type not defined" for the first and second lines... Any help is always appreciated!

 Dim dbMyDB As Database
    Dim rsMyRS As RecordSet

dbMyDB = OpenDatabase("\\Ptldat16\ibdfin$\MIS\Department\Databases\phone memo backend.mdb")
0
Comment
Question by:c9k9h
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 12

Accepted Solution

by:
rgn2121 earned 1000 total points
ID: 24093634
Here is one way...  What it looks like you are doing is trying to use an old approach (VB6) in VB.Net.  I would suggest reading up on DB connections...
http://www.java2s.com/Tutorial/VB/0480__Database-ADO.net/CreateOleDbConnectiontoAccessdatabase.htm
 
0
 
LVL 12

Expert Comment

by:rgn2121
ID: 24093643
0
 
LVL 9

Expert Comment

by:Sreedhar Vengala
ID: 24093645
Something in this order:
Dim dbE As DAO.DBEngine
        Dim db As DAO.Database
        Dim rs As DAO.Recordset
        Dim strCon As String
        Dim x, y As Integer

        dbE = New DAO.DBEngine()
        strCon = "Northwind.mdb"
        db = dbE.OpenDatabase(strCon)
        rs = db.OpenRecordset("Products")
        rs.Index = "ProductName"
        rs.MoveFirst()
        For x = 0 To 5
            For y = 0 To 5
                Console.Write(rs.Fields(y).Value)
            Next
            Console.WriteLine()
            rs.MoveNext()
        Next
        rs.Close()
        db.Close()
0
 
LVL 12

Expert Comment

by:rgn2121
ID: 24093650
There is also a "Forms over Data" video series for VB.Net on the Web that will walk you through using the designer if that is how you decide to go.  It uses SQL Express, but the logic of it is pretty much the same...
0
 

Author Closing Comment

by:c9k9h
ID: 31567846
Perfect!
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question