Board index » delphi » update a stored procedure
Felix González
![]() Delphi Developer |
Felix González
![]() Delphi Developer |
update a stored procedure2005-09-30 07:22:39 PM delphi50 Hello I´m using dbexpress. and I`ve in a sqlquery an sored procedure. How can update the table in the field name of stored procedure is diferent the in the table? I use OnGetTableName to set the table name, but filed name?. I`m using orign of TField but donsen´t work. Thanks |
Martijn Tonies
![]() Delphi Developer |
2005-09-30 08:37:09 PM
Re:update a stored procedure
Felix,
QuoteI´m using dbexpress. and I`ve in a sqlquery an sored procedure. How can the question? -- With regards, Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL Server Upscene Productions www.upscene.com Database development questions? Check the forum! www.databasedevelopmentforum.com |
Bill Todd
![]() Delphi Developer |
2005-09-30 10:46:48 PM
Re:update a stored procedure
The easy solution is to change the stored procedure to return the
actual field name from the table. The only alternative is to write a BeforeUpdateRecord event handler and generate the SQL yourself. -- Bill Todd (TeamB) |
Felix González
![]() Delphi Developer |
2005-09-30 10:56:24 PM
Re:update a stored procedure
Sorry.
I´m using Delphi 7 and Firebird 1.5. In my DB I`ve a sored procedure that select row from a table:somthing like : create procedure pp returns(C1 varchar(100)) as begin for select Campo1 from table into:C1 do suspend; end the name of field in table it´s "Campo1" and the procedure returns "C1" in my delphi progrma I`ve a SQLquery (select * from procedure) with a DatasetProvider and a ClientDataSet When I applyUpdates I get an error beceause C1 not exist´s on Table. How can update the table using this DataSetProvider? Thanks "Martijn Tonies" <XXXX@XXXXX.COM>escribi?en el mensaje news:433d310d$XXXX@XXXXX.COM... QuoteFelix, |
Martijn Tonies
![]() Delphi Developer |
2005-09-30 11:16:19 PM
Re:update a stored procedure
Hello Felix,
QuoteI´m using Delphi 7 and Firebird 1.5. In my DB I`ve a sored procedure that select The result of a selectable procedure does not HAVE to come from a table, it can be lots of things, or even no table at all. For example: create procedure one_two_three returns ( i integer ) as begin i = 1; suspend; i = 2; suspend; i = 3; suspend; end This will return a resultset just fine. The reason why I am telling this? Simple. If you insist on letting the Delphi components generate the SQL that is being executed, you should understand that these components assume you're selecting from a table. In this case, you are not, which complicates things for auto-generated SQL, as you have found out. You might have to "help" it, or even use a different approach to updating the data, like creating the SQL yourself. -- With regards, Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL Server Upscene Productions www.upscene.com Database development questions? Check the forum! www.databasedevelopmentforum.com |
Remo Tex
![]() Delphi Developer |
2005-10-03 05:43:37 PM
Re:update a stored procedure
Why don't you use a View?... for selecting single columns or values from
different tables: with parameters and/or updatable view Martijn Tonies writes: QuoteHello Felix, |