Hello all,

I work with MSSQL2000 and Delphi. I want to insert new values in the Master_Detail_VW (see script below) using the ADO components. I tried something like this:

var
ADOQuery1:TAdoQuery;
begin
.
.
.
ADOQuery1.SQL.Append('select * from Master_Detail_VW');
ADOQuery1.Insert;
ADOQuery1.FieldByName('Id').AsInteger = '3';
ADOQuery1.FieldByName('Master_Name').AsString = 'c';
ADOQuery1.FieldByName('Detail_Name').AsString = 'd';
ADOQuery1.Post;
.
.
.
end;

AdoQuery raised the EOleException 'Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available' on Post.
I tried the same with BDE and had no problems.

Can anybody HELP ME?
Thanks.
Paan-cha


/* My db */


create table Master (Id int, Name char(1))
go

insert into Master (Id, Name) values (1, 'A')
go

insert into MAster (Id, Name) values (2, 'B')
go

create table Detail (Master int, Name char(1))
go

insert into Detail (Master, Name) values (1, 'A')
go

create view Master_Detail_VW with schemabinding
as
select Master.Id, nullif(Master.Name, null) Master_Name, nullif(Detail.Name, null) Detail_Name
from dbo.Master Master
left outer join dbo.Detail Detail on Master.Id = Detail.Master
go

create trigger Master_Detail_VW_I on Master_Detail_VW
instead of insert
as
begin
if exists (select 1
from inserted)
begin
insert into Master
(Id, Name)
select Id, Master_Name
from Inserted

insert into Detail
(Master, Name)
select Id, Detail_Name
from Inserted
end
end
go


/*
insert into Master_Detail_VW
(Id, Master_Name, Detail_Name)
values
(3, 'c', 'd')
*/