Duplicate database and field name

Post Reply
pawelu
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland
Contact:

Duplicate database and field name

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 ;
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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" ; 
   ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply