为什么在C#中使用存储过程? [英] Why use stored procedure in C#?

查看:77
本文介绍了为什么在C#中使用存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




在我的C#Windows窗体应用程序项目中,我对我的

代码进行了所有查询。

现在我想尝试使用存储过程。

但是我不清楚为什么要使用存储过程。

有人会给我一些建议吗?

感谢您的帮助。


Jason

Hi,

In my C# Windows Form application project, I have done all queries on my
codes.
Now I wanna try using the Stored Procedure.
But I am not clear about why using the stored procedure.
Would some one give me some advice?
Thanks for help.

Jason

推荐答案



" ; Jason Huang < JA ************ @ hotmail.com>在消息中写道

新闻:eC ************* @ TK2MSFTNGP10.phx.gbl ...

"Jason Huang" <Ja************@hotmail.com> wrote in message
news:eC*************@TK2MSFTNGP10.phx.gbl...


在我的C#Windows窗体应用程序项目中,我对我的
代码进行了所有查询。
现在我想尝试使用存储过程。
但我不清楚为什么使用存储过程。
有人会给我一些建议吗?
感谢您的帮助。
Hi,

In my C# Windows Form application project, I have done all queries on my
codes.
Now I wanna try using the Stored Procedure.
But I am not clear about why using the stored procedure.
Would some one give me some advice?
Thanks for help.




1.将应用程序与数据库模式隔离开来。

2.允许模拟数据库中的继承和其他OO功能

(即派生类通常会映射到两个表,SP可以隐藏

this)

3.允许应用仅限访问那些操作和

所需的数据。



1. To isolate the app from the database schema.
2. To allow simulation of inheritance and other OO features in the database
(i.e. a derived class will typically map to two tables and SPs can hide
this)
3. To allow the app to have access restricted to only those operations and
data that it needs.


似乎非常全面!

" Nick Hounsome" < NH *** @ nickhounsome.me.uk> ????????????? D:SX ********************* @ fe1.news.bl ueyonder.co.uk .. 。
Seems very comprehensive!
"Nick Hounsome" <nh***@nickhounsome.me.uk> ???g?ó?l¥ó·s?D:SX*********************@fe1.news.bl ueyonder.co.uk...

Jason Huang < JA ************ @ hotmail.com>在消息中写道
新闻:eC ************* @ TK2MSFTNGP10.phx.gbl ...

"Jason Huang" <Ja************@hotmail.com> wrote in message
news:eC*************@TK2MSFTNGP10.phx.gbl...


在我的C#Windows窗体应用程序项目中,我对我的
代码进行了所有查询。
现在我想尝试使用存储过程。
但我不清楚为什么使用存储过程。
有人会给我一些建议吗?
感谢您的帮助。
Hi,

In my C# Windows Form application project, I have done all queries on my
codes.
Now I wanna try using the Stored Procedure.
But I am not clear about why using the stored procedure.
Would some one give me some advice?
Thanks for help.



1.将应用程序与数据库架构隔离开来。
2. To允许模拟
数据库中的继承和其他OO功能(即派生类通常映射到两个表,SP可以隐藏这个)
3.允许应用程序限制访问只有那些操作和它需要的数据。



1. To isolate the app from the database schema.
2. To allow simulation of inheritance and other OO features in the
database (i.e. a derived class will typically map to two tables and SPs
can hide this)
3. To allow the app to have access restricted to only those operations and
data that it needs.



Nick Hounsome写道:
Nick Hounsome wrote:
< Jason Huang < JA ************ @ hotmail.com>在消息中写道
新闻:eC ************* @ TK2MSFTNGP10.phx.gbl ...

"Jason Huang" <Ja************@hotmail.com> wrote in message
news:eC*************@TK2MSFTNGP10.phx.gbl...


在我的C#Windows窗体应用程序项目中,我已经对我的代码做了所有查询。
现在我想尝试使用存储过程。
但我不清楚为什么使用存储过程。
有人会给我一些建议吗?
感谢您的帮助。
1.将应用程序与数据库架构隔离开来。
Hi,

In my C# Windows Form application project, I have done all queries
on my codes.
Now I wanna try using the Stored Procedure.
But I am not clear about why using the stored procedure.
Would some one give me some advice?
Thanks for help.
1. To isolate the app from the database schema.




从什么时候开始需要proc?

2.允许模拟
数据库中的继承和其他OO功能(即派生类通常会映射到两个表格和
SP可以隐藏这个)


如果没有proc,我可以做得很好。如果你真的想要它在数据库中的
,你也可以用一个视图来做。一个视图甚至更实用,因为你不必硬编码过滤器语句在

proc。

3。允许应用程序仅限访问所需的操作和数据。



since when do you need a proc for that?
2. To allow simulation of inheritance and other OO features in the
database (i.e. a derived class will typically map to two tables and
SPs can hide this)
I can do that perfectly fine without a proc. If you truly want it
inside the db, you can also do it with a view. A view is even more
practical as well, as you don''t have to hardcode filter statements in
the proc.
3. To allow the app to have access restricted to only those
operations and data that it needs.




您也可以使用不同的方法。 (基于角色的安全性)。


FB


-

--------- -------------------------------------------------- -------------

LLBLGen Pro的首席开发人员,.NET的高效O / R映射器

LLBLGen Pro网站: http://www.llblgen.com

我的.NET博客: http://weblogs.asp.net/fbouma

Microsoft MVP(C#)

------------------------------------ ------------------------------------



you can also do that with different methods. (role based security).

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------


这篇关于为什么在C#中使用存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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