Page 1 of 1

Duplicate database and field name

Posted: Tue Apr 04, 2006 7:33 am
by pawelu
Antonio,

I create this code. When I try create browse object for database with field name like database error is generated (data width).

Code: Select all

Function TestDFN ()

   Local oWnd := Nil
   Local oLst := Nil
   Local aStr := {}
   Local i := 0

   AAdd (aStr, {'TestDfn', 'C', 30, 0})
   AAdd (aStr, {'F2',      'N',  5, 0})
   DbCreate ('TestDfn', aStr)
   Use TestDFN New
   For i := 1 To 50
       TestDFN->(DbAppend ())
       TestDFN->TestDFN := 'Field:' + PadL (i, 2)
       TestDFN->F2      := i
   Next
   TestDFN->(DbGoTop ())

   Define Window oWnd Title 'Test DFN'

   @ 20, 0 ListBox oLst ;
   Alias TestDFN ;
   Fields ;
   TestDFN->TestDFN, ;
   TransForm (TestDFN->F2, '99') ;
   FieldSizes 100, 30 ;
   Headers 'TestDFN', 'F2' ;
   Size 240, 200 ;
   Pixel

   Activate Window oWnd

Return .T.
Regards
Pawel

Posted: Tue Apr 04, 2006 8:25 am
by Antonio Linares
Pawel,

Code: Select all

   local cAlias := "TestDFN"

   ...

   @ 20, 0 ListBox oLst ; 
   Alias cAlias ; 
   ...
or simply remove this line:

Code: Select all

   Alias TestDFN ;

Posted: Tue Apr 04, 2006 9:24 am
by Antonio Linares
Pawel,

This is the right fix:

Code: Select all

   @ 20, 0 ListBox oLst ; 
   Fields ; 
   TestDFN->TestDFN, ; 
   TransForm (TestDFN->F2, '99') ; 
   Alias "TestDFN" ; 
   ...