问题描述
您好,
我对存储过程和C#有一点问题。
我有一个存储过程,应该只在桌子上插入一些东西。
例如:
ALTER PROCEDURE DBO.PROC1
AS
插入dbo.Test值(''test'')
当我在Visual Studio Envirment中执行此程序时右键单击
就可以了。它做了它应该的程序过程在我的表中插入一行。
但如果我从C#执行它,它就不会。
SqlCommand cmd = new SqlCommand(" proc1",conn);
cmd.ExecuteNonQuery();
我收到1行已被记录的消息 - 但是表格中没有条目。
有没有人有一些想法我做错了什么?
谢谢!
Jacek
Hello,
I have got a little problem with stored procedures and C#.
I have got a stored procedure which should only insert something in a table.
For example:
ALTER PROCEDURE DBO.PROC1
AS
insert into dbo.Test values (''test'')
when I execute this procedure in my Visual Studio Envirment with right click
on it. It makes what it should The procedure inserts a row in my table.
But if I trie to execute it from C#, it doesn''t.
SqlCommand cmd = new SqlCommand("proc1",conn);
cmd.ExecuteNonQuery();
I get the message that 1 row has been affekted - but there is no entry in
the table.
Does anyone has some ideas what I have done wrong?
Thanks!
Jacek
推荐答案
这篇关于C#和SQL-Server存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!