存储过程和aspx页面出现问题 [英] Problem with stored procedure and aspx page

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

问题描述

我正在创建一个包含插入,更新和删除查询的存储过程.
我想使用此单个存储过程在我的aspx页面中执行插入,更新和删除操作.
我知道如何在aspx页面中使用单个存储过程,但我不知道单个存储过程包含多个查询并在aspx页面中使用
请给我建议

谢谢
Ratish kumar jha

i am creating a stored procedure that contain insert,update and delete query.
I want to use this single stored procedure to perform insert, update and delete operation in my aspx page.
i know how to use single stored procedure in aspx page but I don''t know single store procedure contain multiple query and use in aspx page
pls give me suggestion

Thanks
Ratish kumar jha

推荐答案

建议这样做的人和原因:我正在创建一个包含插入,更新和删除查询的存储过程.

这怎么可能呢?好吧,实际上只有在if-else情况下才需要对操作类型进行操作.但是在SP中对它们进行三个单独的查询没有任何意义.执行您的SP将执行所有三个查询.

我建议为每个操作保留单独的SP.如果要将所有三个操作合并到一个SP中,则将操作类型-插入/更新/删除作为存储过程的参数之一.根据此输入,仅运行相关查询.您可以使用SQL-If.

详细信息在这里:
MSDN:IF ... ELSE(Transact-SQL) [ ^ ]
SQL IF ... ELSE语句 [
Who and why this was suggested: i am create single stored procedure that contain insert,update and delete query.

How is this even possible? Well actually it is only with if-else case on operation type. But having three separate queries in SP for them does not make any sense. Executing your SP will execute all the three queries.

I would suggest to keep separate SP''s for each operation. In case you want to club all three operation into one SP then pass on the operation type - insert/update/delete as one of the parameters of stored procedure. Based on this input, run related query only. You can use SQL-If for it.

Details here:
MSDN: IF...ELSE (Transact-SQL)[^]
SQL IF...ELSE Statement [^]


您好,
这是我执行相同文章的文章.请参考以下链接:
将DataTable发送到存储过程 [
Hi,
Here is my article which performs the same. Refer the links below:
Sending DataTable to a Stored Procedure[^]
You can view the queries and fornt-end operation in that.

--Amit


嗨..
您可以通过存储过程传递某些参数,然后检索参数,然后在单个存储过程中使用3个查询,并在.aspx页中也执行单个存储的过程..
Hi..
You pass certain parameters through the stored procedure then retrieve the parameters then use the 3 queries within a single store proc and execute the single stored proc in the .aspx page too..


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

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