screen.resolution.set (512,384)
@data = database.load ("dbaseold.dbf")
display_my_base ()
%num_of_recording= database.record.number.get (@data)
text.display ("The number of records in the database is : "+STR (%num_of_recording),CENTER,150)
text.display ("Press a key to add a new record to the database.",CENTER,350)
keyboard.wait ()
database.record.new (@data)
database.field.set (@data,1,"New record.")
database.save (@data)
%num_of_recording= database.record.number.get (@data)
text.display ("The number of records in the database is : "+STR (%num_of_recording),CENTER,150)
text.display (" Press a key to exit. ",CENTER,350)
display_my_base ()
keyboard.wait ()
script.stop ()
procedure display_my_base ()
%x=0
if (@data!=NULL)
database.free (@data)
endif ()
@data = database.load ("dbase.dbf")
for (%field=1 to database.field.number.get (@data))
$name=database.field.name.get (@data,%field)
text.backcolor.select (COLOR_BLUE)
text.display ($name,%x,%y)
for (%rec=1 to database.record.number.get (@data))
text.backcolor.select (128,128,128)
database.record.set (@data,%rec)
%y+=10
switch (database.field.type.get (@data,%field))
case (DATABASE_CHAR)
$dat=database.field.get (@data,%field)
text.display ($dat,%x,%y)
case (DATABASE_NUMERIC)
%dat=database.field.get (@data,%field)
text.display (str(%dat),%x,%y)
case (DATABASE_FLOAT)
!dat=database.field.get (@data,%field)
text.display (str(!dat,"####.####"),%x,%y)
endswitch ()
next ()
%y=0
%x+=database.field.size.get (@data,%field)*20
next ()
text.backcolor.select (COLOR_DEFAULT)
end procedure