Help on creating dbf file

Help on creating dbf file

Postby tsai8839 » 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
tsai8839
 
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

Postby James Bott » Sat Jul 29, 2006 4:12 pm

It is hard to debug without knowing the contents of oLbx:aItems. Can you provide us with a small sample?
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby tsai8839 » 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
tsai8839
 
Posts: 22
Joined: Mon Jul 24, 2006 6:45 am

Re: Help on creating dbf file

Postby zlatan24 » 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.
zlatan24
 
Posts: 5
Joined: Thu Jul 02, 2009 6:46 am

Re:

Postby Bayron » Tue Sep 27, 2011 3: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
(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...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 6 guests