Subject | Re: [IBO] Re: Inserting New Rows - Long-winded? |
---|---|
Author | Robert Nixon |
Post date | 2013-10-21T18:10:50Z |
Hi Helen
You gave me an unusual sensation - it's been a while since I left electronics and entered software development in 1968 that I've been called a newbie. However you're perhaps not far from the mark in this case, as I used Delphi 4 to build a single user stock control and invoicing system for a club, and not much else. But I did get to the point of answering queries posted on Tek-Tips, so not altogether useless.
Delphi was an attempt to understand windows development as I'd (foolishly?) gone into management after the mainframe and minicomputer eras - must admit I loved it after assembler and early versions of COBOL and BASIC. I'm now trying to build a multi-user system with a proper DB at zero cost for a charity.
I don't recall what went wrong with data modules in Delphi 4 but your helpful instruction means I'll try it again. Sufficiently impressed by your HTH approach, I'm now reading your Getting Started book. So you can hope that I'll not be asking too many more questions!
From: Helen Borrie <helebor@...>
To: IBObjects@yahoogroups.com
Sent: Sunday, 20 October 2013, 22:29
Subject: Re: [IBO] Re: Inserting New Rows - Long-winded?
You gave me an unusual sensation - it's been a while since I left electronics and entered software development in 1968 that I've been called a newbie. However you're perhaps not far from the mark in this case, as I used Delphi 4 to build a single user stock control and invoicing system for a club, and not much else. But I did get to the point of answering queries posted on Tek-Tips, so not altogether useless.
Delphi was an attempt to understand windows development as I'd (foolishly?) gone into management after the mainframe and minicomputer eras - must admit I loved it after assembler and early versions of COBOL and BASIC. I'm now trying to build a multi-user system with a proper DB at zero cost for a charity.
I don't recall what went wrong with data modules in Delphi 4 but your helpful instruction means I'll try it again. Sufficiently impressed by your HTH approach, I'm now reading your Getting Started book. So you can hope that I'll not be asking too many more questions!
Regards
Robert
From: Helen Borrie <helebor@...>
To: IBObjects@yahoogroups.com
Sent: Sunday, 20 October 2013, 22:29
Subject: Re: [IBO] Re: Inserting New Rows - Long-winded?
At 08:39 a.m. 21/10/2013, robert_nixon@... wrote:
1. You get a dataset using a SELECT statement
2. If the dataset is "editable" (and there are database-engine-specific rules for this, besides ObjectPascal properties) then the DA components construct INSERT, UPDATE and DELETE statements automatically, which kick in when the mode (Insert/Edit/Delete) is changed by the Delphi application. (You can customise these statements in many component sets, including IBO, using the InsertSQL, EditSQL and DeleteSQL properties.)
It sounds as though you are a bit of a newbie in Delphi as well as IBO. You could do yourself a big favour by working through the sample apps that are installed with IBO....that said, I don't think Jason used datamodules in those projects. But, as I indicated before, using a DM is no different from using a form unit. It's just a very elegant way to separate your data layer from your user interface layer and to package up that DA layer for access by multiple form units (and other datamodule units, if you have them).
There is a miscellany of articles on the IBObject website that could help you through some of your "sticky" points. Also, I wrote a Getting Started Guide some years ago, that is still available in the IBO shop. It's very much a work-through of the principles of IBO and is *not* a general tutorial about data access in Delphi.
HTH
Helen
>Thanks for your quick reply, Helen. It seems a bit "wrong" to have a method that appears to ignore the SQL statement in the query, which is perhaps why I was looking in the wrong places, but it's very convenient.It's the way all data access components for Delphi do their work. It's totally different to programming in native Paradox!
1. You get a dataset using a SELECT statement
2. If the dataset is "editable" (and there are database-engine-specific rules for this, besides ObjectPascal properties) then the DA components construct INSERT, UPDATE and DELETE statements automatically, which kick in when the mode (Insert/Edit/Delete) is changed by the Delphi application. (You can customise these statements in many component sets, including IBO, using the InsertSQL, EditSQL and DeleteSQL properties.)
>I was interested to see your commendation for using a data module. I tried this when I was using Paradox (yes, quite a while ago) and could not make it work without re-declaring everything, and I've seen someone do that with a proper RDBMS too. Is there a text available on how to make it work properly?I'm sure there is - Google will know. Datamodules have been around since Delphi 2, afair, and were often the subject of conference presentations back in the day. But it's not rocket science at all. A datamodule is just another Delphi unit. You put your connections, datasources and datasets there (and ib_sessions, if you are using other than the default) and you put the datamodule's name into the uses clause of any forms that want to access it. Then, all the data access components on your datamodule are available in the selector lists on those forms.
It sounds as though you are a bit of a newbie in Delphi as well as IBO. You could do yourself a big favour by working through the sample apps that are installed with IBO....that said, I don't think Jason used datamodules in those projects. But, as I indicated before, using a DM is no different from using a form unit. It's just a very elegant way to separate your data layer from your user interface layer and to package up that DA layer for access by multiple form units (and other datamodule units, if you have them).
There is a miscellany of articles on the IBObject website that could help you through some of your "sticky" points. Also, I wrote a Getting Started Guide some years ago, that is still available in the IBO shop. It's very much a work-through of the principles of IBO and is *not* a general tutorial about data access in Delphi.
HTH
Helen