存储过程对多个用户有用吗? [英] Does Stored Procedure useful with multiple users.

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

问题描述

你好。



我有一个C#应用程序。在打印报表时,数据从多个表中提取,然后插入到新表中。因此,新生成的表包含用于打印的所有记录。

为此,我创建了一个存储过程,首先删除以前的记录,然后从不同的表中插入新记录。

问题是当用户打印特定记录的报告时,同时第二个用户删除该记录,记录将被第一个用户看到。如果没有,SP会处理这种情况吗?



需要建议

最好的问候

Hello There

I have a C# application. While printing the report, data was fetched from multiple tables and then inserts into a new table. So the new generated table contains all the records used to print.
For this, I have created a Stored Procedure which first delete previous records and then insert new records from different tables.
Question is when a user print the report for a particular record, at the same time second user delete that record,does record will be seen by first user. If not, will SP handle this situation ?

Need Suggestion
Best Regards

推荐答案

它与使用存储过程无关。

首先,这是一个与设计相关的问题:在运行期间不要创建表(只需使用字段将行绑定到会话或用户),或者如果你使用临时表 [ ^ ]。

另一种方法是使用交易:1 - 开始快照,2 - 选择你的记录到(临时)表,3 - 做报告,4 - 回滚交易

By方式:使用交易 [ ^ ],您可能根本不需要该表 - 但它可能会影响性能e,所以你必须仔细计划。
It has nothing to do with using stored procedure or not.
First of all, it is a design related question: don''t create tables during run (simply use a field to bind rows to the session or user), or if yo dou use temporary tables[^].
An other approach is to use a transaction: 1 - start a snapshot, 2 - select your records into the (temporary) table, 3 - do the report, 4 - rollback transaction
By the way: using transactions[^], you will probably not need that table at all - but it can affect performance, so you have to plan carefully.


两种方式......

1。

您可以简单地 添加一列Userid

并使用此用户ID删除并添加特定用户的行







2。

使用临时表


http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/e70c61c9-5d5f-4525-8be9-3a3df3e2c0ed / [ ^ ]



快乐编码!

:)
two ways...
1.
you can simply add a column Userid
and use this userid to delete and add row for particular user

Or

2.
use temporary table

http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/e70c61c9-5d5f-4525-8be9-3a3df3e2c0ed/[^]

Happy Coding!
:)


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

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