Hi,
Please bare with me.... Lets get one thing out of the way. I never use
DB Connection components on Forms and never use DB-aware components.
I'm a OPF guy, so using the database components on a day-to-day basis
is not something I am familiar with.
So that said, I thought I would play with the SqlDB components today
because I want to complete the SqlDB persistence layer for tiOPF.
The ingredients I used for today are:
TIBConnection, TSQLTransaction, TSQLQuery, TDataSource and TDBGrid.
I got everything to work and data to be displayed in the TDBGrid, but
here is where the 'madness' part comes in. The _very strange_ way I
had to connect the above components.
Step 1:
======
TIBConnection <- TSQLTransaction via 'Database' property. No problem here.
Step 2:
======
TIBConnection -> TSQLTransaction via 'Transaction' property.
Why??? Why must you link components in both directions?
Step 3:
======
TSQLTransaction <- TSQLQuery via 'Transaction' property. No problems here.
Step 4:
======
TIBConnection <- TSQLQuery via 'Database' property. Why??? Can't
it figure it out from the TSQLTransaction it's hooked up to already
(step 3)? What happens if the Transaction component is hooked up to
DB1 and then I specify DB2 in the Database property?
Step 5a:
======
TSQLQuery <- TDatasource via the 'Dataset' property. No problems here.
Step 5b: (optional)
======
TSQLQuery -> TDatasource via the 'DataSource' property. It can be
done, but wasn't needed to get my example project to work. Not sure
what's the rules about this one.
Step 6:
======
TDBGrid <- TDatasource via the 'DataSource' property. No problems here.
So if you haven't figured it out, my issues are with steps 2, 4 & 5b.
I really can't see why they are needed in the first place. Linking
components in both directions are simply redundant. Has nobody
thought this as strange?
It's like dropping a PopupMenu on a Form and then setting the
following (which isn't needed by the way). Form.PopupMenu :=
PopupMenu. & PopupMenu.Control := Form
I worked with Delphi 7 using BDE and DOA (Direct Oracle Access) and
never had to set links between database components in both directions.
Below is the code generated in the .lfm file if the above wasn't clear.
-------------------[ Copy ]------------------------
object IBConnection1: TIBConnection
Connected = True
Streamedconnected = True
DatabaseName = 'm2'
Password = 'masterkey'
Transaction = SQLTransaction1
UserName = 'sysdba'
HostName = '192.168.0.1'
Dialect = 3
left = 40
top = 8
end
object SQLTransaction1: TSQLTransaction
Active = True
Database = IBConnection1
left = 78
top = 8
end
object SQLQuery1: TSQLQuery
Active = True
Database = IBConnection1
Transaction = SQLTransaction1
SQL.Strings = (
'select * from Users'
)
Params = <>
UpdateMode = upWhereKeyOnly
UsePrimaryKeyAsKey = True
ParseSQL = True
left = 118
top = 8
end
object Datasource1: TDatasource
DataSet = SQLQuery1
left = 78
top = 48
end
-------------------[ End ]------------------------
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives