CDaoTableDef & Microsoft ACCESS 7.0
aan -- wise_man@indo.net.id
Monday, November 18, 1996
Environment: VC++ 4.2-flat, Win 95
I'm using CDaoTableDef to create .MDB file from my application.
I just create few fields without index nor relation.
If I open the .mdb file I just created with ACCESS 7.0 then I close the
file, I cannot open it the second time. I just get OLE Automation Error
from ACCESS.
Did anyone ever try this before ? or it may be I got bad installation ?
Thanks
mensoeng
wise_man@indo.net.id
Jim Leavitt -- jimll@halcyon.com
Wednesday, November 20, 1996
[Mini-digest: 3 responses]
Aan:
You wrote:
Environment: VC++ 4.2-flat, Win 95
I'm using CDaoTableDef to create .MDB file from my application.
I just create few fields without index nor relation.
If I open the .mdb file I just created with ACCESS 7.0 then I close the
file, I cannot open it the second time. I just get OLE Automation Error
from ACCESS.
Did anyone ever try this before ? or it may be I got bad installation ?
I Reply:
Yes, I use temp databases all the time with Dao. I have not seen
this problem.
Jim Leavitt
jimll@halcyon.com
-----From: "John Bundgaard"
I had the same problem. The OLE Automation Error happend because my
database
contains binary fields, and the value i these fields was som non OLE
binarydata.
If you want to view the database files from Access 7.0 then you can creat=
e
a new
database with links to the original fields.
John Bundgaard
=D8rum & Jensen Elektronik A/S
johnb@image.dk
-----From: Jean-Francois Bertrand
Environment: VC++ 4.2-flat, Win 95
I get that exact same message but I believe you wanted to say that you =
create your database using =
----CDaoDatabase.Create("c:\\MyFileName.mdb")---
Because you can't create a database from CDaoTableDef...
I tried that for the first time yesterday I'm going to try a couple of =
thing today to see if I can find a way to avoid that.
The problem is when you use CDaoDatabase.Create( ) even you do not =
define any tables in your database, the database created will be =
unusable after you open it once. You can just open it with access 7.0 =
and close it (Without making any changes), you will get the error =
message OLE Automation Error. Is the function CDaoDatabase.Create( ) =
instanciate an OLE object that we should know about? And if so, can we =
disable it?
If I create an empty database (Using Access 7.0) and I use =
CDaoDatabase.Open( ), I can create tables, index and relations for those =
tables without any problems. There is absolutely no problem with =
CDaoTableDef.Create( ) to create tables, the problem resides in =
CDaoDatabase.Create( ). I've look in the MSDN CD and no indication or =
warning about that are noted.
I would appreciate any help I could get.
I'll install the patch(4.2b) today and try it again.
Thanks
Jim Leavitt -- jimll@halcyon.com
Saturday, November 23, 1996
Gentlemen:
With respect to the problem:
"I'm using CDaoTableDef to create .MDB file from my application.
I just create few fields without index nor relation.
If I open the .mdb file I just created with ACCESS 7.0 then I close the
file, I cannot open it the second time. I just get OLE Automation Error
from ACCESS."
I cannot duplicate it. I'm using VC4.2b, Winnt 4.0, Access 7 (Office 95).
If my environment is the same or similar to yours, I wonder what we're doing
differently. (Or perhaps I don't understand the problem).
I do create a temp database under dao every time my app starts up. I use the
temp database to let me quickly sort the results of complex queries (crosstabs, etc).
I run the query, create a table in the temp database and then use the temp database
table for displays, etc. It works just fine.
I can start my application, create some temp tables and quit. I can open and close the
temp database as many times as I choose.
I can start my application and quit immediately. Now the temp database has no tables,
it's just completely blank. I can open and close it as many times as I choose.
If my application is running and I try to open the temp database, I get an error message
telling me the file is in use. I'm not getting any OLE automation errors.
Some thoughts...
I've overridden ExitInstance...
int CInspectorApp::ExitInstance()
{
GXTerminate(); // terminates objective grid (fine product!)
if (m_pDB) // Application holds both the primary and temp dbs
{
if(m_pDB->IsOpen())
m_pDB->Close();
delete m_pDB;
}
if (m_pTempDB)
{
if (m_pTempDB->IsOpen())
m_pTempDB->Close();
delete m_pTempDB;
}
return CWinApp::ExitInstance();
}
to close the databases when the app exits.
I'm also careful to close recordsets when I'm done with them. I'm sure
you're doing the same. Anyway, with several of us reporting the same
problem, I'm curious.
Jim Leavitt
jimll@halcyon.com
aan -- wise_man@indo.net.id
Sunday, November 24, 1996
Environment: VC++ 4.2-flat, Win 95
Here is the simplified version of my program:
CDaoDatabase *db = new CDaoDatabase();
CDaoTableDef *tbldef;
db->Create( ".\\test.mdb" );
tbldef = new CDaoTableDef( db );
tbldef->Create( "TABLE_1" );
tbldef->CreateField( "FIELD_1", dbText, 16, dbFixedField );
tbldef->Append();
tbldef->Close();
delete tbldef;
delete db;
the file test.mdb created size is 47104 Bytes, Open it with ACCESS 7.0
then exit without saving increase the file size to 83968 Bytes.
However the original file is good for other DAO operation (add/delete
record etc.).
I tried to create .MDB file with same structure with ACCESS, then inspect
both files with DAOVIEW.EXE (see your VC 4.2 CDROM directory
\MSDEV\SAMPLES\MFC\DATABASE\DAOVIEW ) there's no difference. But I believe
there's must be difference inside the files.
aan -- wise_man@indo.net.id
Wednesday, November 27, 1996
Environment: VC++ 4.2-flat, Win 95
I just solved my problem with .MDB files created with
CDaoDatabase::Create()
The solution is simple: Install Windows 95 Service Pack.
I think the problem is from OLE32.DLL
Thank's for all of you.
| Вернуться в корень Архива
|