VS 2005 Help on Access MDB's (1 Viewer)

ShimmyShamrock

New member
Local time
Today, 01:30
Joined
Sep 6, 2006
Messages
1
Greetings,

I have an application written in VB 5, which opens an Access 97 MDB, executes stored queries - that's it! Simple enough. Now, I've upgraded my Access 97 MDB to Access 2003 MDB to point to an Oracle 10G server.

However, I've upgraded to VS 2005 (yikes) and proceeded with the upgrade wizard - it broke everything!

I wondering if anyone could provide a simple translation for the following VB5 code to VS 2005 without using the "Add Data Sources" stuff.


Dim db As DAO.Database
Dim qd As DAO.QueryDef

Set db = OpenDatabase("ACCESS97.MDB")

Set qd = db.QueryDefs("BUILD LOCAL TABLE FROM ODBC SOURCE")
qd.Execute


Thanks so much.
 
Last edited:

skea

Registered User.
Local time
Today, 09:30
Joined
Dec 21, 2004
Messages
342
here is the translation.
.....
1) Create a connection string to your database
2) Create a command object
3) Create a stored query or Procedure in access using CREATE PROC
3) Open the connection.
4) ExecuteNonQuery against the command object
5) Close and dispose the objects.
.....You MIGHT have to drop the PROC first as well, so use DROP PROC for that.

Below is how to create a procedure in access
Code:
CREATE PROC myproc AS 
SELECT * FROM TABLENAME;
 

Users who are viewing this thread

Top Bottom