Subject | Using TIB_QUERY |
---|---|
Author | Dave Bullar |
Post date | 2001-09-15T14:30:12Z |
Here are my attempts. With all the scratchings out !
I am trying to use a tib_query to do a simple insert.
The address table has four required entries:
Addressnum .. primary key
Add1.. first line of addres
Postcd..postcode
Publicity .. a bit of data about where did you here about us.
of course this is rubbish data I am just trying out.
My final effort works but is this how it should be ???
(I know there should be a transaction around it but I can deal with that)
begin
// qryaddress.RequestLive := true;
qryaddress.SQL := qryaddress.InsertSQL;
//###### is the above really needed..it wont work without ####
// qryaddress.Insert;
qryaddress.Prepare;
// qryaddress.Insert;
// qryaddress.Open;
// qryaddress.Edit;
qryaddress.params.ByName('addressnum').AsInteger := 19;
qryaddress.params.ByName('add1').AsString:=
'big place';
qryaddress.params.ByName('postcd').AsString := 'wert';
qryaddress.params.ByName('publicity').AsString := 'popo';
qryaddress.open;
// qryaddress.Insert;
// qryaddress.post;
qryaddress.close;
OK this works but is it correct ??
Help. Put it how it should be Please !!
Does the 'open' method do any 'fetching' ??
I am trying to use a tib_query to do a simple insert.
The address table has four required entries:
Addressnum .. primary key
Add1.. first line of addres
Postcd..postcode
Publicity .. a bit of data about where did you here about us.
of course this is rubbish data I am just trying out.
My final effort works but is this how it should be ???
(I know there should be a transaction around it but I can deal with that)
begin
// qryaddress.RequestLive := true;
qryaddress.SQL := qryaddress.InsertSQL;
//###### is the above really needed..it wont work without ####
// qryaddress.Insert;
qryaddress.Prepare;
// qryaddress.Insert;
// qryaddress.Open;
// qryaddress.Edit;
qryaddress.params.ByName('addressnum').AsInteger := 19;
qryaddress.params.ByName('add1').AsString:=
'big place';
qryaddress.params.ByName('postcd').AsString := 'wert';
qryaddress.params.ByName('publicity').AsString := 'popo';
qryaddress.open;
// qryaddress.Insert;
// qryaddress.post;
qryaddress.close;
OK this works but is it correct ??
Help. Put it how it should be Please !!
Does the 'open' method do any 'fetching' ??