using a VB6 written function in C#

G

Guest

I need a guide or a point in direction as to how to do this.
I'm upgrading a software written in VB6 to C# ASP.NET.
Problem is that VB6 puts files into Access DB using an OLE Container, and
takes it out as OLE Container, while C# uses the OLE Objects in Access as a
Blob field, and shoves in bytes, so C# can't read the file in the Ole Object
field, nor can it upload the data in the Ole Container format.
This upgrade should not interfer with the old software's operation, so the
old VB6 program will still need to read the OLE Container added in with the
new software.
Solution:
I need to somehow write a VB function, that takes byte array or stream as
parameter, makes an OLE Container, and returns the OLE Container as byte
array or stream back. (And another function to do the reverse of this). Then
C# will take this function to do the conversion and streams in the data into
the Ole Object field.

Someone please help!
 
G

Guest

There are two ways I can think of to accomplish this:

1. Using a tool like OLE View, find the COM library that contains the OLE
Container and use TlbExp to create a wrapper (or create a COM reference in
your project for that DLL).

2. Wrap the COM version of the OLEDB data access (or make a COM reference to
the OLEDB library MDAC).

You will still have some potential issues, but this is the easiest way I
know of to avoid data corruption. Until you move to .NET, you will have a
perf hit from interop with COM.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

mm....I took a look with the ole/com viewer....can't really find anything
that directly has to do with ole container.
Also tried to add reference to the oledb COM stuff, but there aren't much in
there that deals with ole container.

is there a way to make a dll (in vb or c++) that can do the conversion, then
pinvoke it with .net?

(correct me if I'm wrong in anyway, I've read up on pinvoke, but the vast
difficulty of it still overwhelms me)
 
G

Guest

Or even simpler, is there a way to just get rid of the container so that I
can get the original file? I know that the ole header varies in length
depending on the file type, and for pdf's, there's even some sort of footer
that ends it off.
 
G

Guest

After doing some rereading and thinking...

YUK..

Backward compatiblilty sucks..
At least if it was an aspx soultion you could just set the response.stream's
response.type and then send the data..

However I am 90% certain that this won't work with the olecontainer control.

So ignore my last post, I can't help you.
 
G

Guest

If this is written in asp.net what is the source of your image?

Are you uploading it via a fileupload component to the webserver from the
client or are you gettting it from the file system on the webserver?

And then what do you want to do with it? (after it has been saved to your db?)
 
G

Guest

I've seen that there's this ole32.dll up on the pinvoke.net website.
is there a way I could use that somehow to do what I need to do?
I can't really find any sample code that uses the ole32.dll.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top