如何创建和执行存储过程 [英] How to create and execute a stored procedure

查看:95
本文介绍了如何创建和执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发桌面应用程序.我想知道如何创建存储过程,如何调用存储过程,如何编译和执行存储过程.
在此先感谢您.

I am working on a desktop application..I want to know how to create a stored procedure,how to call the stored procedure ,how to compile and execute it.
Thanks in advance.

推荐答案

在这里,请看以下内容:
MSDN:HOW TO:使用ADO.NET和Visual C#.NET调用参数化存储过程 [ ADO.NET:使用存储过程 [ MSDN:创建过程(Transact-SQL) [
Here, have a look at these:
MSDN: HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET[^]
ADO.NET : Using Stored Procedures[^]
MSDN: CREATE PROCEDURE (Transact-SQL)[^]





这是示例存储过程,仅供参考


例如:CREATE PROCEDER dbo.sp_test
(
@id int
)
作为

从id = @ id
的人中选择姓名
执行类似
的过程

例如:exec dbo.sp_test 23
此处id = 23
并给出ID为23的名称
Hi,


Here is the sample stored procedure for You are reference


eg: CREATE PROCEDER dbo.sp_test
(
@id int
)
as

select name from person where id=@id

execute procedure like


eg: exec dbo.sp_test 23
Here id=23
and it gives the name of id 23


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

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