运行存储过程时,args太多 [英] Too many args when running a stored procedure

查看:63
本文介绍了运行存储过程时,args太多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继承我的SP :(我想添加超过1个字段但得到相同的错误

无论我尝试添加多少,我想我会尝试插入主要

仅限密钥并从那里开始工作,但是主键插入没有工作

。我可以在Visual Studio .NET中手动运行SP并且它可以工作。当

i尝试做到这一点它没有。


任何帮助都非常感谢...新手在这里也请温柔

:)


ALTER PROCEDURE dbo.AddJob

@JobNumber varchar(30)

AS

INSERT INTO [工作]。[dbo]。[工作]

(JobRefNum)

VALUES

(@JobNumber)

代码:

SqlCommand1.CommandType = CommandType.StoredProcedure

SqlCommand1.CommandText =" Jobs.dbo.AddJob"

SqlCommand1。 Parameters.Add(" @ JobNumber",txtJobRefNumber.Text)

SqlCommand1.ExecuteNonQuery()

解决案例

MK写道:

继承人我的SP :(我试图添加超过1个字段但得到相同的错误
无论我尝试添加多少,我想我会尝试只插入主键,然后从那里开始工作,但主键插入也没有工作
。我可以在Visual Studio .NET中手动运行SP并且它可以工作。当我尝试这样做时,它不会。

任何帮助都非常感谢...新手在这里也请温柔
:)

ALTER PROCEDURE dbo.AddJob
@JobNumber varchar(30)
AS
插入[工作]。[dbo]。[工作]
(JobRefNum)
VALUES
(@ JobNumber)

代码:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText =" Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add(" @ JobNumber",txtJobRefNumber.Text)
SqlCommand1.ExecuteNonQuery()




ALTER PROCEDURE dbo .AddJob



@JobNumber varchar(30)



AS

INSERT INTO [工作]。[dbo]。[工作]

(JobRefNum)

VALUES

(@JobNumber)


同样的问题

我复制了你的代码并注释掉了其他所有内容..


Mark


" Chris" < no@spam.com>在消息中写道

news:e6 ************** @ TK2MSFTNGP14.phx.gbl ...

MK写道:

继承人我的SP :(我试图添加超过1个字段,但无论我尝试添加多少都会得到相同的错误,我想我会尝试插入
只有主键并从那里开始工作,但是主键插件
也没有用。我可以在Visual Studio .NET中手动运行SP并且它可以工作。当我尝试这样做时它不会''' t。

非常感谢任何帮助...这里也是新手所以请温柔:)

ALTER PROCEDURE dbo.AddJob
@ JobNumber varchar(30)
AS
插入[工作]。[dbo]。[工作]
(JobRefNum)
VALUES
(@JobNumber)
代码:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText =" Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add(" @ JobNumber", txtJobRefNumber.Text)
SqlCommand1。 ExecuteNonQuery()



ALTER PROCEDURE dbo.AddJob

@JobNumber varchar(30)

AS
INSERT INTO [工作]。[dbo]。[工作]
(JobRefNum)
VALUES
(@JobNumber)



您收到的确切错误消息文本是什么?我们是否可以假设SP也在Jobs数据库中?
?很多问题可能会出现问题,但是如果没有确切的代码和DDL,那就完全是猜测了。


M K < SK ******* @ yahoo.com>在消息中写道

news:qL ******************* @ twister.southeast.rr.co m ...

无论我尝试添加多少,我想我会尝试仅插入
主键从那里开始工作但是主键插件也没有工作。我可以在Visual Studio .NET中手动运行SP并且它可以工作。当我尝试这样做时它不会。

任何帮助都非常感谢...新手在这里也请温柔
:)

ALTER PROCEDURE dbo.AddJob
@JobNumber varchar( 30)
AS
插入[工作]。[dbo]。[工作]
(JobRefNum)
VALUES
(@JobNumber)

代码:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText =" Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add(" @ JobNumber",txtJobRefNumber.Text )
SqlCommand1.ExecuteNonQuery()


Heres my SP: ( i am trying to add more than 1 field but get the same error
no matter how many i try to add, i thought i would try to insert the primary
key only and work up from there but the primary key insert didnt work
either. I can run the SP manually in Visual Studio .NET and it works. When
i try to do this it doesn''t.

Any help is greatly appreciated... newbie here as well so please be gentle
:)

ALTER PROCEDURE dbo.AddJob
@JobNumber varchar(30)
AS
INSERT INTO [Jobs].[dbo].[Job]
(JobRefNum)
VALUES
(@JobNumber)
Code:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText = "Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add("@JobNumber", txtJobRefNumber.Text)
SqlCommand1.ExecuteNonQuery()

解决方案

M K wrote:

Heres my SP: ( i am trying to add more than 1 field but get the same error
no matter how many i try to add, i thought i would try to insert the primary
key only and work up from there but the primary key insert didnt work
either. I can run the SP manually in Visual Studio .NET and it works. When
i try to do this it doesn''t.

Any help is greatly appreciated... newbie here as well so please be gentle
:)

ALTER PROCEDURE dbo.AddJob
@JobNumber varchar(30)
AS
INSERT INTO [Jobs].[dbo].[Job]
(JobRefNum)
VALUES
(@JobNumber)
Code:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText = "Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add("@JobNumber", txtJobRefNumber.Text)
SqlCommand1.ExecuteNonQuery()



ALTER PROCEDURE dbo.AddJob
(
@JobNumber varchar(30)
)
AS
INSERT INTO [Jobs].[dbo].[Job]
(JobRefNum)
VALUES
(@JobNumber)


Same problem
I copied your code and commented out everything else..

Mark

"Chris" <no@spam.com> wrote in message
news:e6**************@TK2MSFTNGP14.phx.gbl...

M K wrote:

Heres my SP: ( i am trying to add more than 1 field but get the same
error no matter how many i try to add, i thought i would try to insert
the primary key only and work up from there but the primary key insert
didnt work either. I can run the SP manually in Visual Studio .NET and
it works. When i try to do this it doesn''t.

Any help is greatly appreciated... newbie here as well so please be
gentle :)

ALTER PROCEDURE dbo.AddJob
@JobNumber varchar(30)
AS
INSERT INTO [Jobs].[dbo].[Job]
(JobRefNum)
VALUES
(@JobNumber)
Code:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText = "Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add("@JobNumber", txtJobRefNumber.Text)
SqlCommand1.ExecuteNonQuery()



ALTER PROCEDURE dbo.AddJob
(
@JobNumber varchar(30)
)
AS
INSERT INTO [Jobs].[dbo].[Job]
(JobRefNum)
VALUES
(@JobNumber)



What''s the exact error message text you''re receiving? Can we assume that
the SP is in the Jobs database as well? A lot of possible problems come to
mind, but without the exact code and DDL it''s all guesswork.

"M K" <sk*******@yahoo.com> wrote in message
news:qL*******************@twister.southeast.rr.co m...

Heres my SP: ( i am trying to add more than 1 field but get the same error
no matter how many i try to add, i thought i would try to insert the
primary key only and work up from there but the primary key insert didnt
work either. I can run the SP manually in Visual Studio .NET and it
works. When i try to do this it doesn''t.

Any help is greatly appreciated... newbie here as well so please be gentle
:)

ALTER PROCEDURE dbo.AddJob
@JobNumber varchar(30)
AS
INSERT INTO [Jobs].[dbo].[Job]
(JobRefNum)
VALUES
(@JobNumber)
Code:
SqlCommand1.CommandType = CommandType.StoredProcedure
SqlCommand1.CommandText = "Jobs.dbo.AddJob"
SqlCommand1.Parameters.Add("@JobNumber", txtJobRefNumber.Text)
SqlCommand1.ExecuteNonQuery()



这篇关于运行存储过程时,args太多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆