PDA

View Full Version : بروز خطا هنگام اجرای برنامه تحت شبکه



r_mehrizi
شنبه 06 آذر 1389, 09:47 صبح
یک برنامه با asp.net نوشتم روی سرور به خوبی کار می کند اما اگه یک کامپیوتر کلاینت همزمان به سرور وصل بشود و بخواهد با نرم افزار کار کند برنامه خطا می دهد اگر برنامه را رفرش کنم خطای جدیدی می دهد
تنها اگه بانک را restart کنم برنامه درست کار می کند نمی دونم مشکل برنامه از کجاست لطفا راهنمایی کنید چون خیلی ضروری هستش

حمیدرضاصادقیان
شنبه 06 آذر 1389, 09:54 صبح
سلام.لطفا پیغام خطا را هم بنویسید.

r_mehrizi
شنبه 06 آذر 1389, 10:04 صبح
کدم را به این شکل نوشتم


DataTable dt = new DataTable();
BLUser obj1 = new BLUser();
string pwd = FormsAuthentication.HashPasswordForStoringInConfig File(txt_password.Text.Trim(), "md5");
dt = obj1.Login(txt_username.Text.Trim(),pwd);
if (dt.Rows.Count == 1)
{
string str_sex = string.Empty;

if (dt.Rows[0].Field<bool>("u_sex"))
{
str_sex = "خانم";
}
else
{
str_sex = "آقای";
}


public static DataTable Login(string userUserName, string userPassword)
{
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@username",userUserName),
new SqlParameter("@pwd",userPassword)

};
return OperateGetDataTable("sp_tbl_user_Login", ref param);
}


public static DataTable OperateGetDataTable(string StoredProcedureName, ref SqlParameter[] SqlParameters)
{
try
{
SqlDataAdapter cmd = new SqlDataAdapter(StoredProcedureName, con);
cmd.SelectCommand.Parameters.Clear();
cmd.SelectCommand.Parameters.AddRange(SqlParameter s);
cmd.SelectCommand.CommandType = CommandType.StoredProcedure;
DataTable ds = new DataTable();
cmd.SelectCommand.CommandTimeout = 50000;

cmd.Fill(ds);
return ds;
}
catch (Exception ex )
{
//string exMsg = "Message:" + ex.Message + " Source:" + ex.Source + " StackTrace:" + ex.StackTrace;
//TextWriter tw = new StreamWriter(@"c:\inetpub\wwwroot\BBS\BBSDAL\Log.txt");
//tw.WriteLine(exMsg);
//tw.Close();

con.Close();
return null;
}
}
خطای زیر را میده

Server Error in '/BBS/BBS' Application.

Column 'u_sex' does not belong to table .

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.ArgumentException: Column 'u_sex' does not belong to table .

Source Error:

Line 43: string str_sex = string.Empty;
Line 44:
Line 45: if (dt.Rows[0].Field<bool>("u_sex"))
Line 46: {
Line 47: str_sex = "خانم";



اگر برنامه را رفرش کنم دوباره روی خطهای بعدی خطا می دهد