BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with IBDataSet

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express)
View previous topic :: View next topic  
Author Message
Brian
Guest





PostPosted: Mon Apr 26, 2004 1:39 pm    Post subject: Help with IBDataSet Reply with quote



I am struggling to get started with IBDataset and can not find any examples
or tutorials.

Firstly, can a dataset returned by a Select query be Appended to, inserted
into or edited?

How are parameters used?

Of the five SQL statement properties defined for IBDataSet, how do you
control which one is executed by ExecSQL?

Answers to these questions or pointers to relevant examples would be most
welcome.

Thanks
Brian



Back to top
Jeff Overcash (TeamB)
Guest





PostPosted: Mon Apr 26, 2004 2:27 pm    Post subject: Re: Help with IBDataSet Reply with quote




"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
Quote:
I am struggling to get started with IBDataset and can not find any examples
or tutorials.

Firstly, can a dataset returned by a Select query be Appended to, inserted
into or edited?


Yes.

Quote:
How are parameters used?


Same as any other TDataset descendant. They apply only to the
SelectSQL which is the only SQL you can actually execute
directly.

Quote:
Of the five SQL statement properties defined for IBDataSet, how do you
control which one is executed by ExecSQL?


You don't control them at all, IBX does. You are jsut telling
the component how you want the insert to be performed, it
controls when it gets performed.

Quote:
Answers to these questions or pointers to relevant examples would be most
welcome.

Thanks
Brian





Back to top
Brian
Guest





PostPosted: Mon Apr 26, 2004 2:45 pm    Post subject: Re: Help with IBDataSet Reply with quote



Using the IBDataSet dataset editor, the IBDataset has generated the
InsertSQL text as follows:

insert into MYTABLE
(CARRIER_ID, CARRIER_NAME, CF, INTERVAL)
values
(:CARRIER_ID, :CARRIER_NAME, :CF, :INTERVAL)

What I can't understand is how to provide the values for the parameters
CARRIER_ID etc, and how to initiate the INSERT SQL operation, as opposed to
any of the other operations that IBDataSet supports.

I can not find a description of this either in the online help or anywhere
else, what documentation or examples exist?

Thanks for any advice
Brian





"Jeff Overcash (TeamB)" <jeffovercash (AT) mindspring (DOT) com> wrote

Quote:

"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
I am struggling to get started with IBDataset and can not find any
examples
or tutorials.

Firstly, can a dataset returned by a Select query be Appended to,
inserted
into or edited?


Yes.

How are parameters used?


Same as any other TDataset descendant. They apply only to the
SelectSQL which is the only SQL you can actually execute
directly.

Of the five SQL statement properties defined for IBDataSet, how do you
control which one is executed by ExecSQL?


You don't control them at all, IBX does. You are jsut telling
the component how you want the insert to be performed, it
controls when it gets performed.

Answers to these questions or pointers to relevant examples would be most
welcome.

Thanks
Brian







Back to top
Patrick Moloney
Guest





PostPosted: Mon Apr 26, 2004 4:54 pm    Post subject: Re: Help with IBDataSet Reply with quote

You might find it easier to start with an IBQuery and look at the help for that.
I think there are some fairly simple but complete examples in the help. That
also covers how to populate those parameters.

Patrick



Back to top
Jeff Overcash (TeamB)
Guest





PostPosted: Mon Apr 26, 2004 6:32 pm    Post subject: Re: Help with IBDataSet Reply with quote


"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
Quote:
Using the IBDataSet dataset editor, the IBDataset has generated the
InsertSQL text as follows:

insert into MYTABLE
(CARRIER_ID, CARRIER_NAME, CF, INTERVAL)
values
(:CARRIER_ID, :CARRIER_NAME, :CF, :INTERVAL)

What I can't understand is how to provide the values for the parameters
CARRIER_ID etc, and how to initiate the INSERT SQL operation, as opposed to
any of the other operations that IBDataSet supports.


You don't. You set the field values and when the insert is
posted IBX moves the field values into the insert's parameters
to execute it for you under the hood.

Quote:
I can not find a description of this either in the online help or anywhere
else, what documentation or examples exist?


That is because it is absolutely no different than other
TDataset descendants. You put the dataset into insert mode,
assign the field values you want to insert and call post. No
different than TClientDataset, BDE or DbGo.



Back to top
Brian
Guest





PostPosted: Mon Apr 26, 2004 7:43 pm    Post subject: Re: Help with IBDataSet Reply with quote

The parameters in IBQuery are apparently quite different from IBDataSet,
IBQuery.Params is a TParam type the same as the BDE components but IBDataSet
is different.

In particular, I want to use an Insert query to create a new row in my
database. With IBDataSet having four or five different SQL statements, I
still can't see how to invoke an Insert SQL as opposed to any of the others
and I still can't see how the parameters are to be populated with the data I
want to put into the new row.

Any explanation or examples would be very useful.
Thanks
Brian



"Patrick Moloney" <patrickmoloney (AT) compuserve (DOT) com> wrote

Quote:
You might find it easier to start with an IBQuery and look at the help for
that.
I think there are some fairly simple but complete examples in the help.
That
also covers how to populate those parameters.

Patrick






Back to top
Brian
Guest





PostPosted: Mon Apr 26, 2004 8:04 pm    Post subject: Re: Help with IBDataSet Reply with quote

The story so far......


I have a table with a primary column which I want to populate from a
generator which I have defined in the database.
The following code applies...

IBDataSet1.Active := True;
IBDataSet1.Insert;
IBDataSet1.FieldByName('TEXT_NAME').AsString := 'My New Text Field';
IBDataSet1.FieldByName('NUMBER').AsFloat := 123.456E+06;
IBDataSet1.Post;

On executing the .Post I get an IB exception : "validation error for
column 'MY_KEY_COL' value ****null****"

I have set the Generator Field property for the IBDataset for the generator
and the destination column but still get the exception.

Help!

Brian


"Jeff Overcash (TeamB)" <jeffovercash (AT) mindspring (DOT) com> wrote

Quote:

"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
Using the IBDataSet dataset editor, the IBDataset has generated the
InsertSQL text as follows:

insert into MYTABLE
(CARRIER_ID, CARRIER_NAME, CF, INTERVAL)
values
(:CARRIER_ID, :CARRIER_NAME, :CF, :INTERVAL)

What I can't understand is how to provide the values for the parameters
CARRIER_ID etc, and how to initiate the INSERT SQL operation, as opposed
to
any of the other operations that IBDataSet supports.


You don't. You set the field values and when the insert is
posted IBX moves the field values into the insert's parameters
to execute it for you under the hood.

I can not find a description of this either in the online help or
anywhere
else, what documentation or examples exist?


That is because it is absolutely no different than other
TDataset descendants. You put the dataset into insert mode,
assign the field values you want to insert and call post. No
different than TClientDataset, BDE or DbGo.





Back to top
Jeff Overcash (TeamB)
Guest





PostPosted: Mon Apr 26, 2004 9:29 pm    Post subject: Re: Help with IBDataSet Reply with quote


"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
Quote:
The story so far......


I have a table with a primary column which I want to populate from a
generator which I have defined in the database.
The following code applies...

IBDataSet1.Active := True;
IBDataSet1.Insert;
IBDataSet1.FieldByName('TEXT_NAME').AsString := 'My New Text Field';
IBDataSet1.FieldByName('NUMBER').AsFloat := 123.456E+06;
IBDataSet1.Post;

On executing the .Post I get an IB exception : "validation error for
column 'MY_KEY_COL' value ****null****"

I have set the Generator Field property for the IBDataset for the generator
and the destination column but still get the exception.

What did you set the event time? If it is OnServer you still have to create a trigger to fill out the vlue when it comes across NULL. The only thing OnServer does is turn off the required property in the local TField.



Back to top
Brian
Guest





PostPosted: Mon Apr 26, 2004 9:41 pm    Post subject: Re: Help with IBDataSet Reply with quote

It is set to "On New Record"



"Jeff Overcash (TeamB)" <jeffovercash (AT) mindspring (DOT) com> wrote

Quote:

"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
The story so far......


I have a table with a primary column which I want to populate from a
generator which I have defined in the database.
The following code applies...

IBDataSet1.Active := True;
IBDataSet1.Insert;
IBDataSet1.FieldByName('TEXT_NAME').AsString := 'My New Text Field';
IBDataSet1.FieldByName('NUMBER').AsFloat := 123.456E+06;
IBDataSet1.Post;

On executing the .Post I get an IB exception : "validation error for
column 'MY_KEY_COL' value ****null****"

I have set the Generator Field property for the IBDataset for the
generator
and the destination column but still get the exception.

What did you set the event time? If it is OnServer you still have to
create a trigger to fill out the vlue when it comes across NULL. The only

thing OnServer does is turn off the required property in the local TField.
Quote:





Back to top
Jeff Overcash (TeamB)
Guest





PostPosted: Tue Apr 27, 2004 3:54 pm    Post subject: Re: Help with IBDataSet Reply with quote


"Brian" <BrianWrigley123 (AT) yahoo (DOT) com> wrote:
Quote:
It is set to "On New Record"


Double check what is exactly sent to hte DB using the SQL
Monitor. I'd look closely at the InsertSQL to make sure that
column is included in it.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.