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.
Help on creating dbf file
Help on creating dbf file
Regards,
Andy Tsai
Andy Tsai
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
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
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
Andy Tsai
Re: Help on creating dbf file
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.
Re:
Maybe it has something to do with that you are including a Chr( 9 ) (Horizontal Tab) in this sentence???oLbx:Modify( xPadR( cName, 100 ) + Chr( 9 ) + cType + ;
Is that what you wanted to include or it was a Chr( 10 ) (Line Feed)
=====>
Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com
FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate
FiveWin, One line of code and it's done...
Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com
FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate
FiveWin, One line of code and it's done...