
I have SDAC 4.35+Delphi 6+MS SQL2k Ent sp4
After insert into view, record dosn't refresh.
Code: Select all
CREATE TABLE [dbo].[WareHouse] (
[idWareHouse] [int] IDENTITY (1, 1) NOT NULL ,
[Name] [varchar] (64)
) ON [PRIMARY]
GO
CREATE view vWarehouse with view_metadata
as
select [idWarehouse], [Name]
from Warehouse
GO
CREATE trigger trWarehouse_INSERT on vWarehouse
instead of insert
as
set nocount on
insert Warehouse([idManager], [Name])
select [idManager], [Name]
from Inserted
set nocount off
GO
CREATE PROCEDURE upWarehouse_GetList
@idWarehouse int=null
as
select [idWarehouse], [Name]
from vWarehouse
where isnull(@idWarehouse, idWarehouse) = idWarehouse
GO
Code: Select all
object sp: TMSStoredProc
StoredProcName = 'upWarehouse_GetList;1'
SQLInsert.Strings = (
'INSERT INTO vWarehouse'
' (idWarehouse, Name)'
'VALUES'
' (:idWarehouse, :Name)'
'SET :idWarehouse = SCOPE_IDENTITY()')
SQLRefresh.Strings = (
'exec upWarehouse_GetList :idWarehouse')
Connection = MSConnection1
SQL.Strings = (
'{:RETURN_VALUE = CALL upWarehouse_GetList;1(:idWarehouse)}')
BeforeUpdateExecute = spBeforeUpdateExecute
Options.UniqueRecords = True
Options.QueryIdentity = True
Options.ReturnParams = True
RefreshOptions = [roAfterInsert]
UpdatingTable = 'vWarehouse'
end
Code: Select all
sp.Insert;
spidWarehouse.Value:=-1; //Set identity, because insert into view.
spName.Value:='Test'+DateTimeToStr(Now);
sp.Post;
In profiler I see:
Code: Select all
declare @P1 int
set @P1=-1
declare @P2 int
set @P2=NULL
exec sp_executesql N'INSERT INTO vWarehouse
(idWarehouse, Name)
VALUES
(@P1, @P2)
SET @P3 = SCOPE_IDENTITY()', N'@P1 int OUTPUT,@P2 varchar(23),@P3 int OUTPUT', @P1 output, 'Test23.06.2008 17:51:08', @P2 output
select @P1, @P2