HELP: access *.dbf

HELP: access *.dbf

Anonymous
Not applicable
270 Views
1 Reply
Message 1 of 2

HELP: access *.dbf

Anonymous
Not applicable
Help me:
I try to read *.dbf file

void dia::OnButton2()
{
CFileDialog dlg(TRUE,NULL,NULL,
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST,
"Dbf Files (*.dbf)|*.dbf|All Files (*.*)|*.*||");

if(dlg.DoModal() == IDOK)
{
file = dlg.GetPathName();
nf = dlg.GetFileName();
}


acutPrintf("\nfile==""%s",file);

CString str;
CString name;

CDatabase *dbs;
CRecordset *rst;
str.Format("DRIVER={Microsoft dBase Driver (*.dbf)}; DefaultDir=%s",file);
dbs=new CDatabase;

dbs->OpenEx(str,CDatabase::noOdbcDialog);

rst=new CRecordset(dbs);
rst->Open(CRecordset::dynaset,"SELECT * FROM nf");
rst->MoveFirst();
while(!rst->IsEOF())
{


rst->GetFieldValue(4,name);
acutPrintf("\nname==""%s",name);
rst->MoveNext();
}
rst->Close();

dbs->Close();
}
But after
dbs->OpenEx(str,CDatabase::noOdbcDialog);
AutoCAD gives out the message:
"Your system might be low on memory"
What to do?
0 Likes
271 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
hi

this message appeares when autocad encounter an
unknown exeption raised by your code

try to encloseing your code in

 

TRY

  .... ur code

CATCH_ALL(e)

    examine  
e

END_CATCH_ALL

 

 cheer


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Help
me:
I try to read *.dbf file

void dia::OnButton2()
{
    CFileDialog
dlg(TRUE,NULL,NULL,
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST |
OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST,
"Dbf Files (*.dbf)|*.dbf|All
Files (*.*)|*.*||");

if(dlg.DoModal() == IDOK)
{

        file = dlg.GetPathName();

nf = dlg.GetFileName();
}


acutPrintf("\nfile==""%s",file);

CString str;
CString name;

CDatabase *dbs;
CRecordset *rst;

    str.Format("DRIVER={Microsoft dBase Driver
(*.dbf)}; DefaultDir=%s",file);
    dbs=new CDatabase;

dbs->OpenEx(str,CDatabase::noOdbcDialog);

rst=new CRecordset(dbs);

    rst->Open(CRecordset::dynaset,"SELECT * FROM
nf");
rst->MoveFirst();
while(!rst->IsEOF())
{


rst->GetFieldValue(4,name);

                acutPrintf("\nname==""%s",name);

rst->MoveNext();
}
rst->Close();

dbs->Close();
}
But after

dbs->OpenEx(str,CDatabase::noOdbcDialog);
AutoCAD gives out the
message:
"Your system might be low on memory"
What to
do?

0 Likes