Sometimes we use list of output variables to catch the data from the SQL fetch. These are the values of the fields from the selected row and are assigned in order to the given output variables. But, sometimes it is wise to use an array to store the fetch results.
In general this can be used when you don't know how many values are return from the SQL fetch or if you have significant number of fetch results are returned. In this case you may need lot of output variables which is cumbersome to maintain within the program.
You can do this as;
Local array of any &arrayFetch = CreateArrayAny(); &SQL = CreateSQL(SQL.YOUR_SQL_OBJECT); While &SQL.Fetch(&arrayFetch) /* Process the row in &arrayFetch . */ MessageBox(0,"",0,0,"First Value: " | &arrayFetch[1] | " Second Value: " | &arrayFetch[2] | " ... " | " Nth Value: " | &arrayFetch[3],0); End-While;
0 comments :
Post a Comment