Subject | re [IBO} entering a new record. |
---|---|
Author | Dave Bullar |
Post date | 2001-06-19T18:54:16Z |
Thanks Helen.
But I am still lost ! (Bit Thick this chap).
A select statement selects and an insert statement inserts. Yes that is obvious.
But you go on to say "when you call the dataset's insert method, IBO will form an Insert statement for you".
I have a Tib_Query connected to a relation. And a lot of edits attached to a dataSource off the query.
Now what should the sql of the TibQuery say? ?
It cant say 'insert into bookings' cos that is not a proper sql statment.
If I say 'select booknum, bookdate, clientnum from bookings' and I have edits 'connected' to these columns then it all seems to work. We get blank edits until something is entered. Then when I close the transaction these values get magically inserted (Probably because 'autoinsert' is set on the data source).
But you seem to be saying don't! because 'select ' will bring down data. I certainly dont want any data I simply want an empty record so that I can fill in the data.
If I don't say 'select .. ' then have I even got a dataset ??
Then you say "when you call the dataset's insert method." I suppose this is to say qryBookings.insert ?? Since a TIB_QUery inherits from Tib_dataset and that has an insert method.
[I have programmed all this once in 'longhand' not using data-aware components but I am trying to take advantage of the clever features of IBO]
Finally the record did get inserted when I closed the transaction, provided I gave it a primary key value eg Booknum=77. But I expect to use a generator and trigger to set the Primary Key. However when I set this up on the database and otherwise left the primary key as null. It still gave an error message ('Booknum is a required field'). (the trigger says "active before insert
if (bookings.booknum is null) bookings.booknum = gen_id(bkgen,1)
Now this has worked for 3 years on my longhand program.
But I note that a 'generatorlinks' appears in the properties of a tib_query, and this I presume is suposed to make the job easier. The help says that it does, and for more details see the 'contact' example. Well the contact example certainly does insert records but I have read it and re-read it and can find no mention of the GeneratorLinks.
Mind you I cannot get to see the DataModule either, or any of the Tib_Queries etc. The Data Module just does not appear !
When I click on the datmodule form in the Program Manager I get just the 'Unit DM_Contact' and no form.
Has Jason deliberatly made the form invisible ? I dont see anywhere in code where he is setting-up the various SQL's. My printer thinks there is a form present because when I say 'print' it asks if I want to scale the form to the page. But then it just prints a white sheet !. It is a ghost form !
The contact example uses Jason's 'DatabaseBar' (A good name that for a new chocolate bar filled with dates and Raisons) to insert delete etc, But I rather want to do it on the closing of a form or by individual buttons.
[Non-text portions of this message have been removed]
But I am still lost ! (Bit Thick this chap).
A select statement selects and an insert statement inserts. Yes that is obvious.
But you go on to say "when you call the dataset's insert method, IBO will form an Insert statement for you".
I have a Tib_Query connected to a relation. And a lot of edits attached to a dataSource off the query.
Now what should the sql of the TibQuery say? ?
It cant say 'insert into bookings' cos that is not a proper sql statment.
If I say 'select booknum, bookdate, clientnum from bookings' and I have edits 'connected' to these columns then it all seems to work. We get blank edits until something is entered. Then when I close the transaction these values get magically inserted (Probably because 'autoinsert' is set on the data source).
But you seem to be saying don't! because 'select ' will bring down data. I certainly dont want any data I simply want an empty record so that I can fill in the data.
If I don't say 'select .. ' then have I even got a dataset ??
Then you say "when you call the dataset's insert method." I suppose this is to say qryBookings.insert ?? Since a TIB_QUery inherits from Tib_dataset and that has an insert method.
[I have programmed all this once in 'longhand' not using data-aware components but I am trying to take advantage of the clever features of IBO]
Finally the record did get inserted when I closed the transaction, provided I gave it a primary key value eg Booknum=77. But I expect to use a generator and trigger to set the Primary Key. However when I set this up on the database and otherwise left the primary key as null. It still gave an error message ('Booknum is a required field'). (the trigger says "active before insert
if (bookings.booknum is null) bookings.booknum = gen_id(bkgen,1)
Now this has worked for 3 years on my longhand program.
But I note that a 'generatorlinks' appears in the properties of a tib_query, and this I presume is suposed to make the job easier. The help says that it does, and for more details see the 'contact' example. Well the contact example certainly does insert records but I have read it and re-read it and can find no mention of the GeneratorLinks.
Mind you I cannot get to see the DataModule either, or any of the Tib_Queries etc. The Data Module just does not appear !
When I click on the datmodule form in the Program Manager I get just the 'Unit DM_Contact' and no form.
Has Jason deliberatly made the form invisible ? I dont see anywhere in code where he is setting-up the various SQL's. My printer thinks there is a form present because when I say 'print' it asks if I want to scale the form to the page. But then it just prints a white sheet !. It is a ghost form !
The contact example uses Jason's 'DatabaseBar' (A good name that for a new chocolate bar filled with dates and Raisons) to insert delete etc, But I rather want to do it on the closing of a form or by individual buttons.
[Non-text portions of this message have been removed]