Declare the PC Cursor definition For//the Cursor
The Select ParentCategoryCode, CategoryCode, CategoryName, CreateDate From ProductCategory Where isNull (StatusFlags, ' ')='1' Order BY CategoryFlags Using gtr_eon;
Open the PC;//open the cursor
The Do While gtr_eon. Sqlcode=0//the cursor passes into an array of data within a
Fetch the PC Into: ls_ParentCategoryCode, : ls_CategoryCode, ls_CategoryName, : ldt_GetDate;//insert cursor data
IF ls_ParentCategoryCode="ALL" Then
Insert Into Swgl_3.. CPLB (UNI, ParentKey LBCODE LBNAME, CreateDate)
VALUES (' _ '+ right (Cast (Newid () AS Char (36)), 9), : ls_ParentCategoryCode, : ls_CategoryCode, : ls_CategoryName, : ldt_GetDate);
The ELSE
String ls_PCUNI
Select parentkey into: ls_PCUNI From SWGL_3.. CPLB Where LBCODE=: ls_ParentCategoryCode;
Insert Into SWGL_3.. CPLB (UNI, ParentKey LBCODE LBNAME, CreateDate)
VALUES (' _ '+ right (Cast (Newid () AS Char (36)), 9), : ls_PCUNI, : ls_CategoryCode, : ls_CategoryName, : ldt_GetDate);
End the IF
//the Fetch PC into: ls_ParentCategoryCode, ls_CategoryCode, : ls_CategoryName, : ldt_GetDate;
Loop;//cycle
IF gtr_fox. Sqlcode=0 Then
Commit the Using gtr_eon;
Lb_1. Additem (gnv_fun. Of_Setmessagelogfile (gs_operator, 1, "synchronous data", "new category", "category successfully saved"))
Lb_1. Setstate (lb_1. Totalitems (), True)
Lb_1. Setstate (lb_1. Totalitems (), False)
The ELSE
The rollback Using gtr_eon;
Lb_1. Additem (gnv_fun. Of_Setmessagelogfile (gs_operator, 1, "synchronous data", "new category", gtr_fox. Sqlerrtext))
Lb_1. Setstate (lb_1. Totalitems (), True)
Lb_1. Setstate (lb_1. Totalitems (), False)
End the IF
Close the PC;//close the cursor
CodePudding user response:
To switch to the DataStore.CodePudding user response: