Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting the recods from cursor
Message
From
20/01/2008 13:27:22
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01283436
Message ID:
01283438
Views:
16
>I am inserting the records from cursor. but only one top record is inserting.
>
>
>
> SELECT student.*, Level.*,exam.*;
> FROM ;
> student,exam ;
> INNER JOIN level ;
> ON Student.lcode = Level.code;
> WHERE scode=thisform.scode.value and lcode=thisform.lcode.Value;
> and sec=thisform.sec.value and admtd=1 AND exam.code=thisform.code.value INTO CURSOR examre1
>
>zpath=path
>zbex=bex_a
>zmonth=Nmonth
>zscode=scode
>zlcode=lcode
>zsec=sec
>zexamcode=code_c
>
> INSERT INTO examtran (ttpath,bex,nmonth,scode,lcode,sec,examcode);
> values (zpath,zbex,zmonth,zscode,zlcode,zsec,zexamcode)
>what is mistake?thanks

INSERT INTO inserts a single record. You could write a loop, as follows - note that I am omitting most variables:
SELECT student.*, Level.*,exam.*;
  FROM ;
  student,exam ;
   INNER JOIN level ;
  ON  Student.lcode = Level.code;
  WHERE scode=thisform.scode.value and lcode=thisform.lcode.Value;
 and sec=thisform.sec.value and admtd=1 AND exam.code=thisform.code.value;
INTO CURSOR examre1

scan
  select ExamTran
  append blank
  replace;
    ttPath with examre1.Path,;
    bex    with examre1.bex_a,;
    ...
endscan

* or:
scan
  scatter name loRecord
  insert into ExamTran (ttPath, Bex, ...);
    values loRecord.Path, loRecord.bex_a, ...)
endscan
Visual FoxPro 9 also has commands to append multiple records directly form an INSERT statement; you must somehow combine those two. But I don't yet feel comfortable with this feature; I will have to look it up eventually.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform