How to access SQL CE 3.5 from VB6

Posted by Masterfu on Stack Overflow See other posts from Stack Overflow or by Masterfu
Published on 2010-04-07T10:06:49Z Indexed on 2010/05/23 3:00 UTC
Read the original article Hit count: 346

Filed under:
|
|
|

We have a .NET 3.5 SP1 application written in C# that stores data in an SQL CE 3.5 Database. We also need to access (read only) this very data from a legacy VB6 application.

I don't know if this is at all possible. There are several approaches to this problem that I can think of.

1) I have read about ADOCE Connections, but this seems to be an option for embedded Visual Basic only

2) I can't seem to get a connection working using ADODB.Connection Objects like so

Dim MyConnObj As New ADODB.Connection
' Microsoft.SQLSERVER.CE.OLEDB.3.5
' Microsoft.SQLSERVER.MOBILE.OLEDB.3.0
MyConnObj.ConnectionString = "Provider=SQLOLEDB;Data Source=c:\test.sdf"
MyConnObj.Open

Maybe this is just a bad choice of providers? I also tried the providers that appear as comments above and different connection strings, but to no avail. Both providers are not installed on my dev machine and won't be installed on my customer's machine.

3) Maybe there is a way to use a more generic approach like ODBC? But I believe this would result in setup / deployment work, right?

Does anyone have any experience with this scenario? As you can see, I am really looking for some good starting points. I also accept answers like "This is drop dead simple and so are you" as long as they come with some guiding directions ;-)

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb6