gridview的存储过程 [英] stored procedure for gridview

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

问题描述



我想要一个用于插入,更新和删除到数据网格视图中的单个存储过程u
谢谢,你<解决方案

您好,您可以对所有操作使用一个存储过程.

编写一个具有所有可能参数的sp,并为每个参数分配空值.



 创建 过程 spUser
 @ ActivityType   bigint  =  @ Uname   varchar ( 50 )= 为空
目标
开始
 如果  @ ActivityType  =  1 
 开始
   - 插入
 结束
 如果  @ ActivityType  =  2 
 开始
   - 更新
 结束
 如果  @ ActivityType  =  3 
 开始
   - 删除
 结束
结束 



我正在使用此功能,如果您对此有任何疑问,请告诉我. :-)


请参阅:
http://www.daniweb.com/web-development/databases/ms-sql/threads/146829 [ ^ ]




您可以使用;"创建多个具有相似名称的存储过程.部件号

 sproc_User;  1  - 要添加
sproc_User;  2  - 进行编辑
sproc_User;  3  - 删除
sproc_User;  4  - 列表 



在上述情况下,您的主要存储过程将为1个名为"sproc_User"的


hi,

i want a single stored procedure for insertion ,updation and deletion into a data grid viewu
thank yo

解决方案

Hi, you can use one stored procedure for all Actions.

write a sp with all possible parameters and assign value null to every parameter.

i.e.

Create procedure spUser
@ActivityType bigint = null,
@Uname varchar(50) = null
As
Begin
 if @ActivityType  = 1
 Begin
   -- Insert
 End
 if @ActivityType  = 2
 Begin
   -- Update
 End
 if @ActivityType  = 3
 Begin
   -- delete
 End
End



I am using this, if you have any problem with this then tell me. :-)


Refer this:
http://www.daniweb.com/web-development/databases/ms-sql/threads/146829[^]


Hi,

you can create more than one stored procedure with similar name using ";" section no.
i.e.

sproc_User;1 --FOR ADD
sproc_User;2 --FOR EDIT
sproc_User;3 --FOR DELETE
sproc_User;4 --FOR LIST



in the above case you main stored procedure will be 1 named "sproc_User"


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

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