Tuesday, 15 June 2010

sql server - Inserting values using Application Engine -



sql server - Inserting values using Application Engine -

i trying insert values text file record using app engine. know done using file layout requirement suggests not utilize file layout needs insert record using app engine people code.

i writing next peoplecode in appengine (here trying add together 1 field value record in example)

local file &myfile; local record &rec_ern; &myfile = getfile("c:\sample.csv", "r", %filepath_absolute); if &myfile.isopen while &myfile.readline(&string); messagebox(0, "", 0, 0, &string); &source_type_id = substring(&string, 1, 3); &stmt= "insert kgs_test (id) values ( &source_type_id)"; sqlexec(&stmt); rem messagebox(0, "", 0, 0, &source_type_id); end-while; end-if; &myfile.close();

the problem facing &source_type_id = substring(&string, 1, 3); variable &source_type_id has value need insert record have created has fields (id,name,age,department).

the issue having variable &source_type_id within string , hence interpreted literally part of string instead of value of variable want.

what need set bind variable in string value , pass value parameter sqlexec.

local file &myfile; &myfile = getfile("c:\sample.csv", "r", %filepath_absolute); if &myfile.isopen while &myfile.readline(&string); messagebox(0, "", 0, 0, &string); &source_type_id = substring(&string, 1, 3); &stmt= "insert kgs_test (id) values ( :1)"; sqlexec(&stmt,&source_type_id); rem messagebox(0, "", 0, 0, &source_type_id); end-while; end-if; &myfile.close();

sql-server peoplesoft peoplesoft-app-engine

No comments:

Post a Comment