c# - Table relation with stored procedure and trigger -
c# - Table relation with stored procedure and trigger -
to create simple have this:
c# form --> tablea (via stored procedure)
what trying achieve:
c# form --> tablea --> tableb
info sent c# form table a. table want send related column table b
tablea (profileid) = table b (userid)
so, created trigger on stored procedure connected c# form:
alter trigger ids on dbo.userprofile insert declare @profileid int select profileid dbo.userprofile insert dbo.users(users.userid) values(@profileid) go
but when stored procedure beingness executed c# form, error:
invalid column name 'userid'.
thanks in advance.
as mentioned in comments on question, improve set inserts transaction in stored proc called, if must trigger, should like. note specific name , insert beingness done inserted table.
alter trigger userprofile_createuser on dbo.userprofile insert begin insert dbo.users (userid) select profileid inserted end go
for more info on virtual tables: http://msdn.microsoft.com/en-us/library/ms191300.aspx
c# sql sql-server
Comments
Post a Comment