PDA

View Full Version : Import Oracle table data into MS Access thru Visual Basic 6 code.


g_srinivas
03-28-03, 05:42
Hi,

Could some one please help me with the above subject?

I am developing an application in Visual Basic 6. In that, I have this
requirement to import an Oracle database table data (only selected
columns) into an MS Access database using Visual Basic 6 Code.
After the table data import, I would use that table as reference
in my VB application and probably use some of the information to
populate into another table.

I would appreciate if you could provide me with any sample code.

Thank you in advance.

Regards,

Srini.

Ixalmida
04-01-03, 11:46
I picked up an excellent book called Oracle and Visual Basic Developer's Handbook on clearance at CompUSA (about $25). It is written by Oracle technical analysts, so the code is detailed and always works as expected. I recommend you get it if you are going to be doing much Oracle work.

There are many ways to go about connecting to an Oracle db. However, the one recommended by Oracle is OO4O (Oracle Object for OLE), which allows you the most functionality.

An example of how to connect using OO4O is:

Dim OraSession as OraSession
Dim OraDatabase as OraDatabase
Dim OraDynaset as OraDynaset
Set OraSession = CreateObject (*OracleInProcServer.XOraSession*)
Set OraDatabase = OraSession.OpenDatabase ("v8i", "[user name]/[password]")

You can then use standard SQL statements with the ExecuteSQL function, such as:

OraDatabase.ExecuteSQL("Begin EmployeeName.GetEmpName (:EMPNO, :ENAME); end;")

That should allow you to retrieve the table data you need. As I said, there are many other methods, so I suggest you get the book so you can decide which is the best for you. Good luck.

g_srinivas
04-02-03, 03:23
Hi Ixalmida,

Thanks a lot for your reply. I have managed to do it using ADO though
I am not sure if its the most efficient way (I am new to VB6). I would
certainly try to get the book you suggested and check out what's in
there. Thanks again for your suggestion.

Cheers!