Link to home
Start Free TrialLog in
Avatar of zionv
zionv

asked on

Fail to create empty document! even with static lib

Hi, encounter a problem when executing myprogram.exe in other computer.

It gives me "Fail to create empty document" error. I've compiled using MFC static lib and it works in my development machine. Once I port it to one of the client machine (without VC studio) it gives me this error. I am using Daodatabase and it involves the following lines

#define DATABASEFILE "C:\\Database.mdb"

CDaoDatabase db;
CDaoRecordset recset(&db);
CString Client,Addr; // End Variables

/*******************************/
//create table
/*******************************/
     
CString lpszFile = DATABASEFILE;
db.Create(lpszFile);
     
CString SqlCmd = "CREATE TABLE MyTable(Date1 VARCHAR(20),Sensor VARCHAR(20),Backend VARCHAR(40),Reasons VARCHAR(128),SourceIP VARCHAR(20),DestIP VARCHAR(20));";

VARCHAR(40),Reasons VARCHAR(128),SourceIP VARCHAR(20),DestIP VARCHAR(20));";
     db.Execute(SqlCmd);

recset.Open(AFX_DAO_USE_DEFAULT_TYPE,"SELECT * FROM MyTable", 0);
......



i suspect it's the database excess problem. But I can run it in my dev machine, why not other machines??  is it something wrong with the dll files.. I have copied all the following dll files into the client's sytem32 but still can't work.

mfc42, mfc42d, mfcd42d, mfcn42d, mfco42d, msvcp60d, msvcrt, msvcrtd, msjet35d, msjet40d.

Can someone enlighten me...thanks in advance
Avatar of williamcampbell
williamcampbell
Flag of United States of America image



 The program will not start without all the MFC dll's so you have those correct.

  Did you copy over C:\\Database.mdb" ?
Avatar of suganthkumar1
suganthkumar1

This error message typically comes when the OnCreate function of CMainFrame Failes (return -1). Please check the code inside the OnCreate, PreCreateWindow, and the constructors of the View and document classes.

Avatar of zionv

ASKER

willaincampbell, I've tried copying the files but still can't run it in other computer....!!

is it something to do with the deployment when we use the DAO? I've install the jetsetup.exe already but still cannot..

suganthkumar1, if you are saying something wrong with  the code, then it shouldn't run on my development PC, but the thing is it CAN run in my dev pc and when I port it to other window based machine, it gives me this error....pls help..
Avatar of zionv

ASKER

hi all, I've tried the portion without the Daodatabase access, it works in other machines.

So what I suspect is the Components that must be installed in the client machine in order to run the Daodatabase thing.

But where should I get the list of files or dlls that must I bundled? I've tried the JetSetup.exe, but still cannot.. pls enlighten..thanks.


   run depends.exe it will give you all the dll's loaded.
Avatar of zionv

ASKER

I"ve solved my problem. It's the DAO SDK that I need to install...thanks
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial