var
tc,tc2 TCursor
ChangedDB, ExportStruct, MyNewStruct String
cntr longint
endVar
cntr = 1
ChangedDB = "myDB.db"
ExportStruct = "myNewStruct.db"
MyNewSpecs = "mySpecs.db"
if not empty(myNewSpecs)
then msgInfo("Error","Can't empty "+myNewSpecs)
return
endif
if not tc.open(ChangedDB)
then msgInfo("Error","Can't open "+ChangedDB)
return
endif
if not tc.enumFieldStruct(ExportStruct)
then msgInfo("Error","Can't export the structure of "+ChangedDB)
return
endif
tc.close()
if not tc.open(MyNewSpecs)
then msgInfo("Error","Can't open "+myNewSpecs)
return
endif
if not tc.edit()
then msgInfo("Error","Can't edit"+myNewSpecs)
return
endif
if not tc2.open(ExportStruct)
then msgInfo("Error","Can't open "+ExportStruct)
return
endif
scan tc2:
tc.insertAfterRecord()
tc."Field Name" = tc2."Field Name"
tc."Type" = "C"
tc."Start" = string(cntr)
tc."Length" = tc2."Size"
cntr = cntr + int(tc2."Size")
endScan
tc.endEdit()
tc.close()
tc2.close()