日期:2014-05-18  浏览次数:20498 次

关于并发的问题
我的添加代码在5个人以上执行就出错误.CSDN上的人说要解决并发问题.对于并发我是刚接触.请问下边是我的代码。我应该加在那个位置
C# code

添加方法
 string name= this.TextBox1.Text.Trim();
        DB_Test dbt = new DB_Test();
        dbt.Uname = name;
        int i = TestManager.Add(dbt);
        if (i>0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('成功');", true);
            bind();
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('失败');", true);
        }



SQL code

存储过程
if exists(select * from sysobjects where name='proc_Add')
drop proc proc_Add
go
create proc proc_Add
@uname nvarchar(50)
as
insert into Test (uname) values(@uname)



------解决方案--------------------
LZ 可以去搜下 timestamp
------解决方案--------------------
错误提示贴出来嘛
------解决方案--------------------
包成一个存储过程应该就没有问题了。