Message 1 of 2
HELP: access *.dbf
Not applicable
07-14-2003
07:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
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?