Subject | RE: [IBO] Using Params |
---|---|
Author | Helen Borrie |
Post date | 2001-01-08T15:35:14Z |
At 05:10 PM 08-01-01 +0200, you wrote:
start, the SQL syntax in the EditSQL is wrong. Unfortunately, though SQL
looks a bit like plain English, you can't just make it up as you go
along. And there is more...
You need a TIB_query with SQL
SELECT * FROM GRADES /* but for preference use the query editor and a
proper field list */
If GradeRef is the primary key, set the Keylinks property to GRADEREF.
Set RequestLive to True.
That's all. You don't need any EditSQL - IBO will construct it internally.
This is how it would be if you needed to do it yourself:
UPDATE Grades
SET GradeName = :GradeName
WHERE GradeRef = :GradeRef
i.e. you don't include aliases or table identifiers in an UPDATE statement.
- IBO does this automatically.
If you need to assign parameters, do it in the BeforePost handler. The
syntax is
...
if TheQuery.State = dssEdit then
begin
ParamByName('GradeRef').AsString := SomeString;
ParamByName('GradeName').AsString := SomeOtherString;
end;
....
H.
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Hi Helen,It does. But the way you are doing it is not the way to do it. :)) For a
>
>I wanted to conserve memory I suppose. I thought that the TIB_Query
>component would allow me to hold table information using the SQL text
>'SELECT * FROM Grades', and at the same time update the table
start, the SQL syntax in the EditSQL is wrong. Unfortunately, though SQL
looks a bit like plain English, you can't just make it up as you go
along. And there is more...
You need a TIB_query with SQL
SELECT * FROM GRADES /* but for preference use the query editor and a
proper field list */
If GradeRef is the primary key, set the Keylinks property to GRADEREF.
Set RequestLive to True.
That's all. You don't need any EditSQL - IBO will construct it internally.
This is how it would be if you needed to do it yourself:
UPDATE Grades
SET GradeName = :GradeName
WHERE GradeRef = :GradeRef
i.e. you don't include aliases or table identifiers in an UPDATE statement.
>using theIf you are using a data-aware control, you don't have to assign the params
>EditSQL 'UPDATE Grades g SET
> g.GradeName =:GradeName
> WHERE g.GradeRef =:GradeRef'
>assigning the params:-
- IBO does this automatically.
If you need to assign parameters, do it in the BeforePost handler. The
syntax is
...
if TheQuery.State = dssEdit then
begin
ParamByName('GradeRef').AsString := SomeString;
ParamByName('GradeName').AsString := SomeOtherString;
end;
....
H.
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________