服务器人数多的时候出现Column XXXX does not belong to table
服务器人数多的时候出现Column XXXX does not belong to table
代码没问题,
最主要的是全是查询语句出现的,返回是datetable类型
更奇怪的是Column XXXX does not belong to table
这个页面执行的时候压根没有这个表,更别说这个字段
刷新的时候这个页面要不就是出现
Column A does not belong to table1
Column A does not belong to table2
Column b does not belong to table3
还有Internal connection fatal error
does not contain a property with the name
等等
上传服务器,人多了就会出现,刷新1下,出现不一样的报错
Server Error in '/' Application.
--------------------------------------------------------------------------------
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'type'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'type'.
很郁闷啊!!!求大神解决
上传1下DLL,就好啦,过一会又出现这个问题,时好时坏。
代码如下:
public static SqlCommand cmd = null;
public static SqlConnection conn = null;
public static string connstr = Maticsoft.DBUtility.PubConstant.GetConnectionString("connstr");
public SQLHelper()
{ }
#region 建立数据库连接对象
/// <summary>
/// 建立数据库连接
/// </summary>
/// <returns>返回一个数据库的连接SqlConnection对象</returns>
public static SqlConnection init()
{
try
{
conn = new SqlConnection(connstr);
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
}
catch (Exception e)
{
throw new Exception(e.Message.ToString());
}
return conn;
}
#endregion
#region 设置SqlCommand对象
/// <summary>
/// 设置SqlCommand对象
/// </summary>
/// <param name="cmd">SqlCommand对象 </param>
/// <param name="cmdText">命令文本</param>
/// <param name="cmdType">命令类型</param>
/// <param name="cmdParms">参数集合</param>
private static void SetCommand(SqlCommand cmd, string cmdText, CommandType cmdType, SqlParameter[] cmdParms)
{
cmd.Connection = conn;
cmd.CommandText = cmdText;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
cmd.Parameters.AddRange(cmdParms);
}
}
#endregion
#region 执行不带参数sql语句,返回一个DataTable对象
/// <summary>
/// 执行不带参数sql语句,返回一个DataTable对象
/// </summary>
/// <param name="cmdText">相应的sql语句</param>
/// <returns>返回一个DataTable对象</returns>
public static DataTable GetDataTable(string cmdText)
{
SqlDataReader reader;
DataTable dt = new DataTable();
try
{
init();
cmd = new SqlCommand(cmdText, conn);
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
dt.Load(reader);
reader.Close();
conn.Close();//---
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
return dt;
}
#endregion
#region 执行带参数的sql语句或存储过程,返回一个DataTable对象
/// <summary>
/// 执行带参数的sql语句或存储过程,返回一个DataTable对象
/// </summary>
/// <param name="cmdText">sql语句或存储过程名</param>
/// <param name="cmdType">命令类型</param>
/// <param name="cmdParms">参数集合</param>
/// <returns>返回一个DataTable对象</returns>
public static DataTable GetDataTable(string cmdText, CommandType cmdType, SqlParameter[] cmdParms)
{
SqlDataReader reader;
DataTable dt = new DataTable();
try
{
init();
cmd = new SqlCommand();
SetCommand(cmd, cmdText, cmdType, cmdParms);
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
dt.Load(reader);
reader.Close();
conn.Close();//---
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
return dt;
}
#endregion
大家看看那里有问题吗,谢谢大神门