![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Mon, Mar 27 2006 3:13 AM | Permanent Link |
"Jeremy Martin" | Hi, Using the latest version of DBISAM and am trying to move fields in a different order using the following code found on ng with MyTable do begin FieldDefs.Update; IndexDefs.Update; if (<NewPosition> > <OldPosition>) then begin FieldDefs.InsertFieldDef(<NewPosition>).Assign(FieldDefs[<OldPosition>]; FieldDefs.Delete(<OldPosition>); end else begin FieldDefs.InsertFieldDef(<NewPosition>).Assign(FieldDefs[<OldPosition>+1 ]; FieldDefs.Delete(<OldPosition>+1); end; AlterTable(....rest of parameters here); end; Problem is when you try and insertfielddef we get the following error A component with the name "FIELDNAME" already exists Any help appreciated Regards Jeremy |
Mon, Mar 27 2006 3:34 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Jeremy
Do the delete before the insert? Better still use SQL for it - much better syntax and a lot easier. Roy Lambert |
Mon, Mar 27 2006 3:15 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Jeremy,
<< Problem is when you try and insertfielddef we get the following error A component with the name "FIELDNAME" already exists >> Roy is correct. When moving field definitions around, you must delete the existing field definition before adding/inserting the new one. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 27 2006 4:15 PM | Permanent Link |
"Iztok Lajovic" | Jeremy,
you can alter position of field (i.e. moving it to another position in table) without loosing its content by SQL statement (example shows moving a column named aColumn, which is a smallint type, to new position 5 regardless where it was before - tested with DBSYS): alter table myTable redefine aColumn smallint at 5 HTH Iztok Lajovic "Jeremy Martin" <jeremy at lanwest dot com dot au> je napisal v sporocilo news:7609C7A5-93B2-47A9-B09C-019CC3E73DA3@news.elevatesoft.com ... > > Hi, > > Using the latest version of DBISAM and am trying to move fields in a > different order using the following code found on ng > > > > with MyTable do > begin > FieldDefs.Update; > IndexDefs.Update; > if (<NewPosition> > <OldPosition>) then > begin > > FieldDefs.InsertFieldDef(<NewPosition>).Assign(FieldDefs[<OldPosition>]; > FieldDefs.Delete(<OldPosition>); > end > else > begin > > FieldDefs.InsertFieldDef(<NewPosition>).Assign(FieldDefs[<OldPosition>+1 > ]; > FieldDefs.Delete(<OldPosition>+1); > end; > AlterTable(....rest of parameters here); > end; > > > > > Problem is when you try and insertfielddef we get the following error > > > A component with the name "FIELDNAME" already exists > > Any help appreciated > > Regards > Jeremy |
This web page was last updated on Monday, June 30, 2025 at 12:49 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |