Click here to Skip to main content
10,500,000 members (75,023 online)
Click here to Skip to main content
Add your own
alternative version


54 bookmarked
Posted 20 May 2002

The alxBase classes for work with DBF files

, 5 Nov 2002
Rate this:
Please Sign up or sign in to vote.
The alxBase classes for work with dbf files.


This classes is useful for work with dbf files. The current version supports formats: FoxPro, Visual FoxPro, dBASEIII - dBASE 5.x, Clipper and HiPer-SIx. The memo fields also are supported. CDBFRecordset provides all the useful functions for navigation and modification in table. CDBFCursorset it is possible to use for work only with the selected records. CDBFTableDef it is used for creation and updating of structure of the table.

Create/Update table structure

For creation/updating of structure of the table are available functions:

  • ModifyTable
  • AddField
  • InsertField
  • ModifyField
  • MoveField
  • DeleteField
  • UpdateTable

For cancels any pending updates you may call function CanselUpdateTable().


	CDBFTableDef mNewTable;
	// begin create

	// add field
	FIELD_REC FieldRec;
	memset(&FieldRec, 0, sizeof(FIELD_REC));
	memcpy(FieldRec.field_name, szFieldName, 10);
	FieldRec.field_type = FLD_TYPE_CHARACTER;
	FieldRec.len_info.char_len = 20;

	// ...

	// end create
catch(CDBFException* e)


For navigation are supported functions:

  • MoveNext
  • MovePrev
  • MoveFirst
  • MoveLast
  • SetAbsolutePosition

You also may use functions: IsEOF(), IsBOF(),

, GetAbsolutePosition().

	CDBFRecordset m_Set;
		// ...
catch(CDBFException* e)

Append/Edit record

For addition, changes of record are functions:

  • Edit
  • SetFieldValue
  • Delete
  • Undelete
  • Update

You also may use functions: LockRecord(), UnlockRecord(),


catch(CDBFException* e)

Find Functions

For find are supported functions:

  • FindNext
  • FindLast
  • FindPrev
	BOOL bFind = m_Set.FindFirst("LIKE('*Club*', NAME)");
		// ...
		bFind = m_Set.FindNext();
catch(CDBFException* e)

Parameter of functions: FindFirst(), FindLast(), ... string expression of dBASE language.


For the filter SetFilter function is used:

	m_Set.SetFilter("LIKE('*Club*', NAME)");
	// ...
catch(CDBFException* e)

This function is supported only in classes CDBFCursorset and CDBFMemCursorset.

DBFView Demo

This sample shows some opportunities of library alxBASE.

More information about the product can be found at <a href="http:"="">


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Russian Federation Russian Federation
Year of birth - 1974.
Eeducation - was ended by Kaliningrad State University in 1997.
Now I work as the engineer-programmer in Kaliningrad (RUSSIA).

You may also be interested in...


Comments and Discussions

QuestionAssertion Failed! Pin
Goa3-Jul-07 7:36
memberGoa3-Jul-07 7:36 
AnswerRe: Assertion Failed! Pin
Goa4-Jul-07 5:18
memberGoa4-Jul-07 5:18 
QuestionalxBase without mfc Pin
joviens19-Dec-06 5:44
memberjoviens19-Dec-06 5:44 
AnswerRe: alxBase without mfc Pin
S Mario26-Oct-09 18:08
memberS Mario26-Oct-09 18:08 
Generalfield content Pin
Joao Araujo21-Jan-06 15:51
memberJoao Araujo21-Jan-06 15:51 
GeneralDelete records Pin
pgiustinoni7-Jul-05 6:49
memberpgiustinoni7-Jul-05 6:49 
GeneralGood work But... Pin
ali TEKE11-Apr-05 3:37
memberali TEKE11-Apr-05 3:37 
GeneralProblem in adding new records Pin
Mr.V.Stephen29-Jan-05 23:04
memberMr.V.Stephen29-Jan-05 23:04 
GeneralRe: Problem in adding new records Pin
EndlessWinter10-Feb-05 16:18
memberEndlessWinter10-Feb-05 16:18 
GeneralIts really a very nice project Pin
vstephen200221-Jan-05 23:37
membervstephen200221-Jan-05 23:37 
GeneralUsing the FindFirst function Pin
Alex Evans1-Nov-04 11:14
memberAlex Evans1-Nov-04 11:14 
GeneralRe: Using the FindFirst function Pin
EndlessWinter10-Feb-05 16:23
memberEndlessWinter10-Feb-05 16:23 
GeneralConverted library for Windos CE Pin
Alex Evans2-Oct-04 21:53
memberAlex Evans2-Oct-04 21:53 
GeneralUsing this with Windows CE Pin
Alex Evans1-Oct-04 20:51
memberAlex Evans1-Oct-04 20:51 
GenerallockRecord() Pin
thangoftin29-Aug-04 18:18
memberthangoftin29-Aug-04 18:18 
GeneralUsing the FindFirst function Pin
Alex Evans1-Nov-04 11:17
memberAlex Evans1-Nov-04 11:17 
QuestionHow can i insert/update/delete image file? Pin
Mr.Ahn7-Jul-04 1:21
memberMr.Ahn7-Jul-04 1:21 
QuestionHow to pack deleted record Pin
simranjeet11-Jun-04 3:08
membersimranjeet11-Jun-04 3:08 
AnswerRe: How to pack deleted record Pin
Alexey14-Jun-04 19:28
memberAlexey14-Jun-04 19:28 
QuestionHow to pack deleted record Pin
simranjit11-Jun-04 3:02
susssimranjit11-Jun-04 3:02 
QuestionSample db files? Pin
chenhuisheng13-Apr-04 15:21
memberchenhuisheng13-Apr-04 15:21 
GeneralGreat!! - one question Pin
bdiamond29-Mar-04 3:30
memberbdiamond29-Mar-04 3:30 
I was having problems with your classes a few days ago, so I stopped using them and opted to use ODBC functions instead to do multiple inserts. The problem was my own because I compiled a debug version of the .lib file and it was conflicting with the release version of my DLL. Now that I took care of that, everything is working great! SetFieldValue() is working about 100 times faster than using ODBC was!! But while I was using ODBC my boss asked me if I could make it also export to Excel, which was also easily done, but slow. Since I'm back using your classes now I'd like to know if you know if there's a way I can derive from your dbfrecordset class with the correct offset in the header fields to do the same thing with an .xls file? Any help would be greatly appreciated. I'm giving your article a rating of 5, by the way!

If it's broken, I probably did it

GeneralRe: Great!! - one question Pin
Alexey29-Mar-04 18:33
memberAlexey29-Mar-04 18:33 
Generalcan't write header info correctly Pin
bdiamond18-Mar-04 7:10
memberbdiamond18-Mar-04 7:10 
GeneralRe: can't write header info correctly Pin
Alexey18-Mar-04 19:42
memberAlexey18-Mar-04 19:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 6 Nov 2002
Article Copyright 2002 by Alexey
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid