PDA

Click to See Complete Forum and Search --> : Alternative method of connecting to my Database


Stockton.S
Nov 7th, 2000, 09:31 AM
I have a database in SQL which I can access through ADO perfectly fine but this database contains Images (OLE OBJECTS)

Officially, Microsoft says this about it in MSDN:

INFO: Issues Migrating from DAO/Jet to ADO/Jet
ID: Q225048

OLE Container Control
Many databases, including the SQL Server 7 Northwind database, contain pictures and other objects saved by Microsoft Access. In Visual Basic, you can see the pictures by binding the OLE Container control to the DAO Data control. However, the OLE Container control is not compatible with the ADO Data control and there is no way to access these pictures and display them using ADO. The OLE Container control cannot be used unbound because GetChunk does not retrieve the data in a format compatible with the ReadFromFile method.


Which is understandably since after all VB is a microsoft program.

But I am not sure how to connect to a DAO database and I cannot find any help out there.

Basically when connecting to the ADO database I cheated and connected an ADODB datasource to my database and then pointed my connection string to ADODB.connectionstring this works fine however I really need some help with the connecting to a database side of things with DAO.

My Database is called MAV-DB and is on server ENG_SERV1 and the table that I am after is Prod_Data_EPD

If anyone can help that would be much appreciated.

Many thanks

Simon

paulw
Nov 7th, 2000, 10:27 AM
You need to set a reference to the latest DAO Object Library

You can use

Dim db As DAO.Database
Set db = OpenDatabase("ENG-SERV1DSN", dbDriverNoPrompt, True, "ODBC;DATABASE=MAV-DB;UID=sa;PWD=;DSN=ENG-SERV1DSN")

Dim tb As DAO.TableDef
Set tb = db.TableDefs("Prod_Data.EPD")

that allows you programattic access to the Table (I have assumed that you have a DSN pointing to your datbase called ENG-SERV1DSN)

If you have access to Access, the help on DAO and ODBC is pretty comprehensive. The future is ADO though and you might be better finding a workround - write your own image viewer?)

Good Luck,

Paul.

Stockton.S
Nov 7th, 2000, 10:36 AM
I am on my way home now for an evening of relaxatioin from all of this but I will try what you have suggested in the morning.

I have a file whick is called MAV-DB.dsn which has the set up information in that I thought that because I was distributing this program to some people in the company that I would have it as a file to save setting up the DSN each time.

I am using ADO to connect to the rest of my database it is just the OLE OBJECT thing that I am having problems and it is not only images that I am storing or wanting to store in my database it is word / adobe / tif / jpg files so I need a method of putting the data into the database I think that the appendchunk is what I need to do isn't it?

Thanks for your help and if I could mail you tommrow that would be appreciated.

Take Care

Simon

paulw
Nov 7th, 2000, 10:58 AM
No probs,

I'm out to battle the floods as well.

You can get me at Paul.Whitfield@Fortisbank.Com

Include a phone no and we can chew the fat...

Cheers,

Paul.