Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
TDataSet column exists |
Wed, May 31 2017 5:15 AM | Permanent Link |
thomh | In order to check if a column exists in a dataset I tried
LCol := DataSet.Columns['MyColumn']; if Assigned(LCol) then begin end; This gives me an Application Error: Column "MyColumn" not found Line: 1 Wrapping the call in a try..except silences the exception: try LCol := DataSet.Columns['MyColumn']; except end if Assigned(LCol) then begin end; But is this the correct way to check if a column exists? // Thom |
Wed, May 31 2017 5:33 AM | Permanent Link |
Walter Matte Tactical Business Corporation | if Dataset.Columns.IndexOf('MyField') = -1 then begin // Field Does Not Exist end; Walter |
Wed, May 31 2017 5:41 AM | Permanent Link |
Uli Becker | function MyForm.ColumnExists(ADataset: TDataset; AColumnName: string):
boolean; var i: integer; begin Result := false; for i := 0 to ADataset.Columns.Count -1 do begin if SameText(ADataset.Columns[i].Name,AColumnName) then begin Result := true; break; end; end; end; Uli |
Wed, May 31 2017 5:41 AM | Permanent Link |
Uli Becker | Walter,
> if Dataset.Columns.IndexOf('MyField') = -1 then > begin > // Field Does Not Exist > end; Simple and effective! Uli |
Wed, May 31 2017 11:03 AM | Permanent Link |
thomh | >Uli Becker wrote:
> >Walter, > >> if Dataset.Columns.IndexOf('MyField') = -1 then >> begin >> // Field Does Not Exist >> end; > >Simple and effective! > >Uli I agree, Uli. Thanks, guys. // Thom |
This web page was last updated on Wednesday, October 9, 2024 at 05:37 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |