Re: Can VB8 read Access DBs?
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Sun, 6 Aug 2006 08:11:47 -0500
"Dick Monahan" <dick@xxxxxxxxxxxxxxx> wrote in message
news:e1uXZoLuGHA.2392@xxxxxxxxxxxxxxxxxxxxxxx
I have a little VB6 program that dumps the schema of an Access 97database.
The following lines of code are relevant.the
Private m_wsDb As DAO.Workspace
Private m_db As DAO.Database
Set m_wsDb = DBEngine.CreateWorkspace("MainWS", "admin", vbNullString)
Set m_db = m_wsDb.OpenDatabase(m_zDbFilePath, False, False, "")
Dim tdf As TableDef
Dim fld As DAO.Field
For Each tdf In m_db.TableDefs
On Error GoTo Form_Activate_Err_Tabledef
Debug.Print "Table "; tdf.Name; " ("; tdf.RecordCount; "records )."
On Error GoTo Form_Activate_Err_Field
For Each fld In tdf.Fields
Debug.Print " Field "; fld.Name; " ("; GetFieldType(fld.Type); ": ";
fld.Size; ")."
Next fld
Next tdf
I converted the program to VB8 (.NET if you prefer). As far as I can see,
the only relevant lines that it changed are these two.
m_wsDb = DAODBEngine_definst.CreateWorkspace("MainWS", "admin",
vbNullString)
Dim tdf As DAO.TableDef
When I try to read the Access 97 database with the VB8 program, it opens
workspace and the database, but when I try to fetch a field, I get:to
A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in
ExportSchema.exe
And Err = 3219 (Invalid operation.).
I also have the same database in Access 2000 and 2003 formats. When I try
read either of them with the VB8 program, I get:
A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in
ExportSchema.exe
And Err = 3343 (Unrecognized database format '<path>'.
What have I missed in converting VB6 -> VB8?
Dick.
Look for newsgroups with the words "dotnet",
"framework", or "vsnet" in their name.
For the news.microsoft.com news server try these:
news://msnews.microsoft.com/
microsoft.public.dotnet.languages.vb.data
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework.interop
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.windowsforms.databinding
</response>
.
- References:
- Can VB8 read Access DBs?
- From: Dick Monahan
- Can VB8 read Access DBs?
- Prev by Date: Can VB8 read Access DBs?
- Next by Date: Re: 3 table query
- Previous by thread: Can VB8 read Access DBs?
- Index(es):
Relevant Pages
|