lpersonid,long,,person’s id spersonfirstname,text,20,person’s first name spersonlastname,text,20,person’s last name bisafunperson,boolean,,invite to a party? itypeofjob,integer,,0=none 1=manual 2=office 3=programmer etc. iage,integer,,person’s age
sub createtable (sdatabasename as string, scsvfilename as string, stablename as string) dim itemp as integer ’将控制权交还给操作系统,使其在创建数据库的同时能运行其它程序-别让你的计算机闲着! itemp = doevents() ’创建一个300x3数组 redim stables(300, 3) as string dim sdatatypeline as string
’打开数据库 dim dbpersons as database set dbpersons = opendatabase(sdatabasename &. ".mdb", true)
’记录下新的表单名 tbl.name = stablename
’增添第一个字段 set fld = new field fld.name = stables(1, 1) fld.type = getfieldtype((stables(1, 2))) fld.size = val(stables(1, 3)) tbl.fields.append fld dbpersons.tabledefs.append tbl
’增加其它的字段 dim inextcol as integer inextcol = 1 do while true set fld = new field inextcol = inextcol 1 ’到了表定义的底部则退出 if stables(inextcol, 1) = "***end***" then exit do end if fld.name = s