السلام عليكم ورحمة الله وبركاته
اخواني اعضاء ومشرفين المنتدى .. عندي مشكلة في السيشن .. سويت قردفيو .. وسويت زر ابلود عشان ارفع ملفات .. وحبيت اضيف اسم الي يحمل الملف يعني يكون في القرد فيو اسم الملف واسم الشخص الي رفع الملف
طبعن انا خزن السيشن وقت تسجيل الدخول وهذه كود تسجيل الدخول string con;
con = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection sqlcon = new SqlConnection();
sqlcon.ConnectionString = con;
SqlCommand sqlcom = new SqlCommand();
sqlcom.Connection = sqlcon;
string command;
int idUser;
command = "select id from Users where Name=@name and Pass=@pass";
sqlcom.CommandText = command;
sqlcon.Open();
sqlcom.Parameters.AddWithValue("@name", TextBox6.Text);
sqlcom.Parameters.AddWithValue("@pass", TextBox7.Text);
idUser = System.Convert.ToInt32(sqlcom.ExecuteScalar());
sqlcon.Close();
if (idUser == 0)
{
Label3.Text = "عذراً , تأكد من إسم المستخدم وكلمة المرور ";
Window3.Visible = true ;
}
else
{
Session["idUser"] = idUser.ToString();
Session["Name"] = TextBox7.Text;
//Window3.Visible = false;
Response.Redirect("Default.aspx");
GridView1.Enabled = true ;
}
=============================
وبعد ماخزنت الاسم في السيشن .. حبيت في صفحت التحميل انه يضيف لي اسم الشخص الي حمل الملف في القرد فيو وهذه كود التحميل
string savePath = Server.MapPath("filetaha");
string fileName = "";
if (Fup.HasFile)
{
fileName = Fup.FileName;
savePath = savePath + "\\" + fileName;
Fup.SaveAs(savePath);
string con;
con = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection sqlcon = new SqlConnection();
sqlcon.ConnectionString = con;
SqlCommand sqlcom = new SqlCommand();
sqlcom.Connection = sqlcon;
string command, myfile;
command = "insert into ali (files,name) values(@files,@name)";
sqlcom.CommandText = command;
sqlcon.Open();
sqlcom.Parameters.AddWithValue("@files", fileName);
sqlcom.Parameters.AddWithValue("@Name", Session["Name"]);
myfile = sqlcom.ExecuteNonQuery().ToString();
sqlcon.Close();
GridView1.DataBind();
}
============
بس المشكلة انه مايضيف لي اسم المستخدم الي حمل الملف .. يضيف لي كلمة المررو تبعه .. وبرفق لك صورة في القرد فيو وانا حابب اضيف اسم المستخدم موش كلمة المرور تبعه
ياليت الي عندة خبرة في هذه الشي .. يقولي وين الخطاء عشان اعدل عليه والله يجعلة في ميزان حسناتك يااارب



