Monday, 10 October 2016

Program to insert the record in foxpro

 Create a table Stude
rollno               number          5
name              character      15
city                 character      15
gender            characer          1
dob                 date
set talk off
clear
use stude
do while .T.
    clear
    store 0 to rno
    store space(15) to nm
    store space(15) to ct
    store space(1) to gn,opt
    store {} to dt
    @2,2 to 23,80 double
    @5,30 say "Student Data Entry" font "Cambria",16
    @8,3 say repl("=",77)
    @10,10 say "Enter roll no: " get rno pict "999" valid rno>0 error "Roll no should be greater than zero"
    @12,10 say "Enter name: "get nm pict "@!"
    @14,10 say "Enter city: "get ct pict "@!"
    @16,10 say "Enter DOB: " get dt function "E"
    @18,10 say "Enter gender: "get gn pict "!" valid gn="M" or gn="F" error "Gender must be M or F"
    @20,3 say repl("=",77)
    @21,20 say "Do you want to add more record?" get opt func "!" pict "Y"
    read
    append blank
    replace rollno with rno
    replace name with nm
    replace city with ct
    replace dob with dt
    replace gender with gn
    if opt="N " then
        exit
    endif
enddo
    use
    clear all
set talk on
   
   

No comments:

Post a Comment