Make sure you change the "is" to TDBISAMTable as well, otherwise you could get runtime errors if it's a TTable but not a TDBISAMTable.
Stacey > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Mark Howard > Sent: Thursday, 25 August 2005 15:48 > To: NZ Borland Developers Group - Delphi List > Subject: Re: [DUG] Component names > > On Thu, 25 Aug 2005 15:16:50 +1200, Stacey Verner > <[EMAIL PROTECTED]> wrote: > > > If Table is TTable then begin > > OpenOneTable(Table as TTable); > > end; > > Yep. Change it to > OpenOneTable(Table as TDBISAMTable); > and it works fine. > > Thanks very much, Stacey > > Mark > > > > > > Stacey > > > >> -----Original Message----- > >> From: [EMAIL PROTECTED] > >> [mailto:[EMAIL PROTECTED] On Behalf Of Mark Howard > >> Sent: Thursday, 25 August 2005 15:09 > >> To: NZ Borland Developers Group - Delphi List > >> Subject: Re: [DUG] Component names > >> > >> OK. I'll try to be more clear, by using the ACTUAL code. > >> > >> I have: > >> "procedure LoadGrid(grid: TStringGrid; table: TDBISAMDBDataset);" > >> > >> The parameter "table" is defined as a Dataset because ususally a > >> TTable is passed but occasionally a TQuery is passed. > >> > >> Before I do stuff, I want to see if the Dataset is active > and if not, > >> open it: so I guess I can do > >> > >> "if not table.active then > >> table.open; > >> > >> BUT I really want to use another procedure > >> > >> "OpenOneTable(table)" instead of table.open becuse it does > a bunch of > >> error trapping > >> > >> Trouble is OpenOneTable requires a TTable to be passed to it > >> - not a TDataset and THAT (finally) is what I need a hand with. > >> > >> Mark > >> > >> PS the reason I am doing this is to speed up the opening > of my app in > >> Client/Server mode by delaying the opening of tables until > they are > >> needed. > >> > >> > >> On Thu, 25 Aug 2005 14:38:14 +1200, Stacey Verner > >> <[EMAIL PROTECTED]> wrote: > >> > >> > I am confused. > >> > > >> > Is the TDataset parameter actually the TTable or a > different object > >> > that just happens to have the same name? > >> > By ??.Name do you mean the component Name or the actual > >> table name in > >> > the database.? > >> > > >> > If the TTable and the TDataset are actually the same object > >> then just > >> > go "if MyTable = MyDataset then begin" > >> > > >> > Stacey > >> > > >> >> -----Original Message----- > >> >> From: [EMAIL PROTECTED] > >> >> [mailto:[EMAIL PROTECTED] On Behalf Of Mark Howard > >> >> Sent: Thursday, 25 August 2005 14:34 > >> >> To: NZ Borland Developers Group - Delphi List > >> >> Subject: Re: [DUG] Component names > >> >> > >> >> Sorry Traci > >> >> > >> >> Didn't make myself clear > >> >> > >> >> I want to test if a TTable with the same name as the parameter > >> >> TDataset is active. > >> >> If it is not I want to Open the TTable that has the > same name as > >> >> TDataset. > >> >> > >> >> Mark > >> >> > >> >> On Thu, 25 Aug 2005 14:18:52 +1200, Traci Sumpter > >> >> <[EMAIL PROTECTED]> wrote: > >> >> > >> >> > If MyDataset.State <> dsActive then > MyDataset.Datasource.Open ; > >> >> > > >> >> > Or try > >> >> > > >> >> > If MyDataset.State <> dsActive then MyDataset.Open ; // > >> not sure if > >> >> > this does the job also > >> >> > > >> >> > > >> >> > -----Original Message----- > >> >> > From: [EMAIL PROTECTED] > >> >> > [mailto:[EMAIL PROTECTED] On Behalf Of Mark Howard > >> >> > Sent: Thursday, 25 August 2005 2:09 p.m. > >> >> > To: [email protected] > >> >> > Subject: [DUG] Component names > >> >> > > >> >> > Hi > >> >> > > >> >> > Newbie (still!) question > >> >> > > >> >> > I have a procedure that is passed a parameter MyDataset > >> : TDataset > >> >> > > >> >> > Within the procedure I want to do > >> >> > > >> >> > if not MyTable.Active then > >> >> > MyTable.Open; > >> >> > > >> >> > where MyTable.Name = MyDataset.Name > >> >> > > >> >> > Can someone please help me with the syntax, which eludes me? > >> >> > > >> >> > Thanks > >> >> > > >> >> > Mark > >> >> > > >> >> > > >> >> > -- > >> >> > Forest Production Systems Ltd > >> >> > Creators of PSLog - A harvesting information system > >> www.pslog.co.nz > >> >> > Skype: markhoward > >> >> > > >> >> > > >> >> > >> >> > >> >> > >> >> -- > >> >> Forest Production Systems Ltd > >> >> Creators of PSLog - A harvesting information system > >> >> www.pslog.co.nz > >> >> Skype: markhoward > >> >> > >> >> > >> >> -- > >> >> No virus found in this outgoing message. > >> >> Checked by AVG Anti-Virus. > >> >> Version: 7.0.344 / Virus Database: 267.10.15/80 - Release > >> >> Date: 23/08/2005 > >> >> > >> >> _______________________________________________ > >> >> Delphi mailing list > >> >> [email protected] > >> >> http://ns3.123.co.nz/mailman/listinfo/delphi > >> >> > >> > > >> > _______________________________________________ > >> > Delphi mailing list > >> > [email protected] > >> > http://ns3.123.co.nz/mailman/listinfo/delphi > >> > > >> > > >> > > >> > >> > >> > >> -- > >> Forest Production Systems Ltd > >> Creators of PSLog - A harvesting information system www.pslog.co.nz > >> Skype: markhoward > >> > >> > >> -- > >> No virus found in this outgoing message. > >> Checked by AVG Anti-Virus. > >> Version: 7.0.344 / Virus Database: 267.10.15/80 - Release > >> Date: 23/08/2005 > >> > >> _______________________________________________ > >> Delphi mailing list > >> [email protected] > >> http://ns3.123.co.nz/mailman/listinfo/delphi > >> > > > > _______________________________________________ > > Delphi mailing list > > [email protected] > > http://ns3.123.co.nz/mailman/listinfo/delphi > > > > > > > > > > -- > Forest Production Systems Ltd > Creators of PSLog - A harvesting information system www.pslog.co.nz > Skype: markhoward > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.344 / Virus Database: 267.10.15/80 - Release > Date: 23/08/2005 > > _______________________________________________ > Delphi mailing list > [email protected] > http://ns3.123.co.nz/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
