超过1个用户同时从ASP.net中以SQL插入数据 [英] More than 1 user inserting data in SQL from ASP.net same time

查看:60
本文介绍了超过1个用户同时从ASP.net中以SQL插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个基于ERP的项目,该项目使用asp.net(3.0)c#作为前端,而sql server(2005)作为后端创建.我们已经完成了该项目,但是在客户端位置上安装之后,当多个用户登录并使用相同的表单执行事务时,所有用户的数据均不匹配.虽然我们为所有用户创建了单独的用户ID和登录名.有人可以建议我该怎么做吗?


我已定义Windows身份验证模式
在登录表单上,我正在从数据库中检查用户的密码和用户名是否正确.
1.执行SP_1,将数据插入表一
2将表中的主键检索到aspx.cs页.
3该主键与其他参数一起提供给SP_2,以插入表二.

假设用户一个在表头部分(表1)中输入了数据,并在详细信息部分(表2)中添加了两个或多个详细信息. 同样,用户两个在标头部分(表1)中输入了数据,并在详细信息部分(表2中)中添加了两个或多个详细信息. 他们两个同时按下保存按钮
在此期间,一个用户的数据无法保存.
但是如果保存,它将向用户显示两个数据,反之亦然.

请提供帮助.

I am working on an ERP based project which was created using asp.net(3.0)c# as the front end and sql server(2005) as the back end. We have completed the project but after installation on the client location, when Multiple users Login and use the same form to perform a transaction, then the data for all users is mismatched. While we have Created Seperate userid and Login for all user. Can anybody suggest to me what I should do?


I have defined Windows authentication mode
On login form i am checking for user from the database whether the password and username is right or not.
1.SP_1 is executed to insert the data in table one
2 the primary key from table is retrived to aspx.cs page.
3 That primary key is provided to SP_2 along with other parameters to insert into table two.

suppose user one entered the data in header section (for table 1) and added two or more details in detail section (for table 2).using hid id
Also the user two entered the data in header section (for table 1) and added two or more details in detail section (for table 2).using his id
Both they press the save button at the same time
in this some time data of one user is not saving .
but if saved then it display the user two data to user one and vice versa.

Please Help.

推荐答案

并发(多用户访问)和锁定
ASP.NET乐观并发控制
http://msdn.microsoft.com/en-us/magazine/cc163924.aspx [ ^ ]
http://www.4guysfromrolla.com/articles/052108-1.aspx [ ^ ]
http://www.15seconds.com/issue/030604.htm [ http://www.asp.net/entity-framework/tutorials/handling-concurrency-with-the-entity-framework-in-an-asp-net-web-application [
Concurrency (Multi User access) and Locking
ASP.NET Optimistic Concurrency Control
http://msdn.microsoft.com/en-us/magazine/cc163924.aspx[^]
http://www.4guysfromrolla.com/articles/052108-1.aspx[^]
http://www.15seconds.com/issue/030604.htm[^]
http://www.asp.net/entity-framework/tutorials/handling-concurrency-with-the-entity-framework-in-an-asp-net-web-application[^]

Let me know your feedback.


使用sqltransaction和sqltransaction隔离级别来锁定数据库.
use sqltransaction and sqltransaction isolation level for lock you database.


这篇关于超过1个用户同时从ASP.net中以SQL插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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