Thêm đối tượng và dữ liệu từ query của 1 bảng vào bảng khác

‘demonstrates how to insert object and data from a query to another table

‘variables to hold values from the query
dim strTheName as string
dim objTheObj as object

‘clean start
close all

‘two tables with maps…
create table bob (thename char(30)) file “c:\” type native
create table bobX (thename char(30)) file “c:\” type native
Create Map For bob
Create Map For bobX

‘insert new row\object in first table
insert into bob (thename, obj) values (“my_name” , createpoint (0,0))

‘query first table
Select thename from bob into bobQ
fetch first from bobQ

‘move obj and data from query to second table

‘this next line doesn’t work, table.column can’t be used inside the values clause
‘insert into bobX (thename, obj) values (bobQ.thename, bobQ.obj) 

‘So, use these variables instead:
strTheName = bobQ.thename
objTheObj = bobQ.obj

insert into bobX (thename, obj) values (strTheName, objTheObj)

Bình luận bằng Facebook Comments