![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Tue, Mar 6 2007 1:52 PM | Permanent Link |
"Mike Saunders" | procedure CreateMemTable(nameoftable :string; Defns: array of Tfield);
var i: integer; TableToCreate: TDBISAMTable; begin ClearMemTable; TableToCreate:=TDBISAMTable.Create(Application); try with TableToCreate do begin DatabaseName:='Memory'; TableName:= nameoftable; Active := False; Exclusive:=True; //why does this not work? for i := Low(Defns) to High(Defns) do begin FieldDefs.AddFieldDef.Name := Defns[i].FieldName; FieldDefs.AddFieldDef.datatype := Defns[i].datatype; FieldDefs.AddFieldDef.size := Defns[i].size; FieldDefs.AddFieldDef.Required := False; end;} // but this does for i := Low(Defns) to High(Defns) do FieldDefs.Add(Defns[i].FieldName,Defns[i].datatype,Defns [i].size,False); if not Exists then CreateTable; end finally TableToCreate.Free; end; end; Thanks Mike |
Tue, Mar 6 2007 1:57 PM | Permanent Link |
Sean McCall | FieldDefs.AddFieldDef is creating a new field definition each time you
call the method. Try: AFieldDef := FieldDefs.AddFieldDef; AFieldDef.Name := AName; AFieldDef.DataType := AType; etc. Sean > procedure CreateMemTable(nameoftable :string; Defns: array of Tfield); > > var i: integer; TableToCreate: TDBISAMTable; > begin > ClearMemTable; > TableToCreate:=TDBISAMTable.Create(Application); > try > with TableToCreate do > begin > DatabaseName:='Memory'; > TableName:= nameoftable; > Active := False; > Exclusive:=True; > > > //why does this not work? > > for i := Low(Defns) to High(Defns) do > begin > FieldDefs.AddFieldDef.Name := Defns[i].FieldName; > FieldDefs.AddFieldDef.datatype := Defns[i].datatype; > FieldDefs.AddFieldDef.size := Defns[i].size; > FieldDefs.AddFieldDef.Required := False; > end;} > > // but this does > > for i := Low(Defns) to High(Defns) do > FieldDefs.Add(Defns[i].FieldName,Defns[i].datatype,Defns > [i].size,False); > > if not Exists then > CreateTable; > end > finally > TableToCreate.Free; > end; > end; > > > Thanks > > Mike > |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |