当多个用户访问网站时,数据重叠正在发生。 [英] The data overlapping is happening while multiple users access the website.
本文介绍了当多个用户访问网站时,数据重叠正在发生。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我们的项目中,我们正在使用这样的DAL功能结构
In our project we are using the DAL function structure like this
public static class Read
{
private static SqlConnection DataConnection;
private static SqlDataAdapter DataAdapter;
private static SqlCommand DataCommand;
private static DataTable objDataTable;
static Read()
{
DataConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["testDB"].ConnectionString);
DataCommand = new SqlCommand();
objDataTable = new DataTable();
DataAdapter = new SqlDataAdapter();
DataCommand.Connection = DataConnection;
DataAdapter.SelectCommand = DataCommand;
}
public static DataTable GetBranchesOfRestaurant(int RestaurantId, out string Error)
{
Error = string.Empty;
objDataTable.Clear();
objDataTable = new DataTable();
DataCommand.CommandText = "GetBranchesOfRestaurant";
DataCommand.Parameters.AddWithValue("@RestaurantId", RestaurantId);
DataCommand.CommandType = CommandType.StoredProcedure;
try
{
if (DataConnection.State != ConnectionState.Open)
DataConnection.Open();
DataAdapter.Fill(objDataTable);
}
catch (Exception ex)
{
Error = ex.Message;
}
finally
{
DataCommand.Parameters.Clear();
DataConnection.Close();
}
return objDataTable;
}
}
但是如果多个用户使用网站,不同的功能重叠,前端功能结果和后端结果重叠其他和网站正在崩溃..什么是DAL功能的标准结构..Plz给我一个解决方案
But if multiple users using the website , different functions are overlapping and, front end function result and back end results are overlapping each other and the site is getting crashed.. what will be a standard structure for DAL function..Plz give me a solution
推荐答案
在asp.net上使用静态成员,函数或属性时必须小心。我认为你的问题就在于此。不要使用静态成员。请编辑您的代码,然后重试。
好日子,
Ibrahim Uylas
Hi,
When using static members, functions or properties on the asp.net You must be careful. I think your problem is it. Don''t use static members. Please edit your code and try again.
Good Days,
Ibrahim Uylas
这篇关于当多个用户访问网站时,数据重叠正在发生。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文