FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper Help on creating dbf file
Posts: 22
Joined: Mon Jul 24, 2006 06:45 AM
Help on creating dbf file
Posted: Sat Jul 29, 2006 12:04 AM

Hi, all

When I try to open a .dbf file by USE(cFilename), I got an error message “Error DBFNTX/1012 Corruption detected”. This .dbf file was created by the following:

for n = 1 to Len( oLbx:aItems )
AAdd( aFields, _FieldInfo( AllTrim( oLbx:aItems[ n ] ) ) )
next
DbCreate( cDbfName, aFields )
MsgInfo( "DBF created!", "AllRight" )

static function _FieldInfo( cItem )
return { StrToken( cItem, 1 ),;
StrToken( cItem, 2 ),;
Val( StrToken( cItem, 3 ) ),;
Val( StrToken( cItem, 4 ) ) }

Any help would be much appreciated.

Regards,



Andy Tsai
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Help on creating dbf file
Posted: Sat Jul 29, 2006 04:12 PM

It is hard to debug without knowing the contents of oLbx:aItems. Can you provide us with a small sample?

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 22
Joined: Mon Jul 24, 2006 06:45 AM
Help on creating dbf file
Posted: Sun Jul 30, 2006 11:53 PM

Dear James,

The following sample may be helpful to debug.

static function AddField( oLbx, oGet, oBtnAdd, oBtnEdit,;
cName, cType, nLen, nDec, lEditing )

if Empty( cName )
MsgInfo( "I need a field name", "Sorry" )
else
if ! lEditing
oLbx:Add( xPadR( cName, 100 ) + Chr( 9 ) + cType + ;
xPadL( Str( nLen, 3 ), 50 ) + xPadL( Str( nDec, 1 ), 20 ),;
oLbx:GetPos() )
else
oLbx:Modify( xPadR( cName, 100 ) + Chr( 9 ) + cType + ;
xPadL( Str( nLen, 3 ), 50 ) + xPadL( Str( nDec, 1 ), 20 ) )
oBtnAdd:SetText( "&Add" )
oBtnEdit:Enable()
lEditing = .f.
endif
cName = Space( 10 )
oGet:Refresh()
oGet:SetFocus( .t. )
endif

return nil

Regards,



Andy Tsai
Posts: 5
Joined: Thu Jul 02, 2009 06:46 AM
Re: Help on creating dbf file
Posted: Tue Sep 27, 2011 11:25 AM
This issue can be solved owing to repair .dbf. It owns all required opportunities for repairing data after various issues: power failures, viruses, hacker attacks. The tool has easy to use and simply interface due to any experienced users.
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re:
Posted: Tue Sep 27, 2011 03:05 PM
oLbx:Modify( xPadR( cName, 100 ) + Chr( 9 ) + cType + ;


Maybe it has something to do with that you are including a Chr( 9 ) (Horizontal Tab) in this sentence???

Is that what you wanted to include or it was a Chr( 10 ) (Line Feed)

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Continue the discussion