Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_ado_rds thread: rds can't update the sqlserver2000 view???


Message #1 by "preny" <czxmail@1...> on Fri, 10 Aug 2001 04:03:58
i create a view in sqlserver2000 like below:



///////////

create view my_view() 

as 

SELECT dbo.a.col, dbo.a.col2, dbo.a.col3, 

      b.name AS ownName, 

      dbo.b.address AS ownAddress, dbo.b.idcard AS ownId, 

      dbo.d.col4

FROM dbo.c INNER JOIN

      dbo.d ON dbo.c.bldName = dbo.d.bldName INNER JOIN

      dbo.a ON dbo.c.BldID = dbo.a.BldID LEFT OUTER JOIN

      dbo.b ON dbo.a.OID = dbo.b.OID

where dbo.a.col2 in (select col2 from my_fn())



i also define a instead of insert,update,delete trigger

//////////



i use rds datacontrol's url property to get the view's data,

but when i use the rds submitChanges method to update this view,nothing 

happened,finally i find the problem is my_fn(),as long as i replace my_fn

() with table,submitChanges successful!

but i must use my_fn(),how can i do???



i define my_fn() like below:



CREATE FUNCTION my_fn()  

RETURNS @ResultT table(

		col2 varchar(10)

	)

AS  

begin



if(...) 

insert into @ResultT select col2 from my_table where col2 in('a','b')

else

insert into @ResultT select col2 from my_table

return

end

  Return to Index