【发布时间】:2017-11-14 12:58:11
【问题描述】:
我是 Vb.net 和 Linq2sql 的新手,在此处发布问题之前我在 google 上搜索了解决方案,但我无法修复它,我正在尝试使用 Vb.net 将行插入数据库和Linq2sql,SubmitChanges() 函数在 '@errno' SQl 异常附近返回不正确的语法。 表相关触发器:
USE [Roster]
GO
/****** Object: Trigger [dbo].[ti_profile] Script Date: 11/14/2017
4:17:00 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[ti_profile] on [dbo].[PROFILE] AFTER INSERT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
declare @ls_profile_code varchar(6)
declare @errno int
declare @errmsg varchar(255)
--set @ls_profile_code = select inserted.profile_code from inserted
-- insert what ever was added to the object table and not yet been inserted or updated in the profile_access
insert into Profile_access (profile_code , object_code)
select (select inserted.profile_code from inserted) ,
object_code
from Objects
where object_code not in
(
select object_code
from Profile_access
where profile_code = @ls_profile_code
)
return
error:
raiserror @errno @errmsg
rollback transaction
END
关于如何解决这个问题的任何想法..
【问题讨论】:
-
首先标记正在使用的正确数据库.. MySQL 与 SQL-server 不同。
-
什么是配置文件以及如何链接到数据库?你有带@errno 参数的触发器或函数吗?
-
@RaymondNijland 谢谢,这是个错误
-
您的代码中没有与
@errno类似的内容,因此我们无法提供帮助。在您的数据库上查找触发器。 -
@JuanCarlosOropeza 我更新了我的问题,请看一下。
标签: sql sql-server vb.net linq-to-sql