图片附件: 游客没有浏览图片的权限,请
登录 或
注册
CLEAR ALL
CLOSE DATABASES ALL
CREATE CURSOR A表 (SPID C(10), 数量 I, 单价 N(10,2), 金额 N(14,2))
INSERT INTO A表 VALUES ("101", 1, 11.11, 11.11)
INSERT INTO A表 VALUES ("303", 3, 33.33, 99.99)
INSERT INTO A表 VALUES ("202", 2, 22.22, 44.44)
INSERT INTO A表 VALUES ("303", 1, 33.33, 33.33)
INSERT INTO A表 VALUES ("101", 4, 11.11, 44.44)
CREATE CURSOR B表 (SPID C(10), 商品名称 C(30), 商品规格 C(20))
INSERT INTO B表 VALUES ("101", "名称1", "规格1")
INSERT INTO B表 VALUES ("202", "名称2", "规格2")
INSERT INTO B表 VALUES ("303", "名称3", "规格3")
INDEX on SPID TAG tSPID
SELECT A表
SET RELATION TO SPID INTO "B表"
GO TOP
_screen.AddObject("grid1","grid")
_screen.grid1.top = 10
_screen.grid1.left = 10
_screen.grid1.width = 500
_screen.grid1.height = 400
_screen.grid1.ColumnCount = 6
_screen.grid1.RecordSourceType = 1
_screen.grid1.RecordSource = "A表"
_screen.grid1.column1.ControlSource = "A表.SPID"
_screen.grid1.column2.ControlSource = "B表.商品名称"
_screen.grid1.column2.Header1.Caption = "品名"
_screen.grid1.column2.Sparse
= .F.
_screen.grid1.column3.ControlSource = "B表.商品规格"
_screen.grid1.column3.Header1.Caption = "规格"
_screen.grid1.column3.Sparse
= .F.
_screen.grid1.column4.ControlSource = "A表.数量"
_screen.grid1.column4.Header1.Caption = "数量"
_screen.grid1.column5.ControlSource = "A表.单价"
_screen.grid1.column5.Header1.Caption = "单价"
_screen.grid1.column6.ControlSource = "A表.金额"
_screen.grid1.column6.Header1.Caption = "金额"
_screen.grid1.Visible = .T.
_screen.grid1.autofit()
RETURN