PDA

View Full Version : مشکل سیشن و کوئری



korosh00
دوشنبه 04 شهریور 1392, 22:02 عصر
سلام
من وقتی لود صفحه از سیشن و کوئری استفاده می کنم
دستور آپدیت من کار نمی کنه مشکل از کجاست ؟

این کد لود صفحه من


if (Session["ddd"] == null)
Response.Redirect("Login.aspx");
if (Session["ddd"] != null)
Label1.Text = Session["ddd"].ToString();
Label2.Text = Request.QueryString["idmm"];
اینم ریختن مقادیر در تکس باکس ها
string


s2 = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=|DataDirectory|\\site.mdb";



OleDbConnection con = new OleDbConnection(s2);



string s1 = "select * from right1 where idright=" + Label4.Text + "";



OleDbCommand com = new OleDbCommand(s1, con);



OleDbDataAdapter adapter1 = new OleDbDataAdapter(com);

adapter1.Fill(ds,

"right1");

con.Open();



OleDbDataReader re = com.ExecuteReader();

re.Read();

TextBox1.Text = re[

"titr"].ToString();

CKEditorControl1.Text = re[

"edameh"].ToString();

con.Close();




اینم کد
مربوط به ویرایش یا همون آپدیت من



string s3 = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=|DataDirectory|\\site.mdb";
OleDbConnection con = new OleDbConnection(s3);
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "update right1 set titr='" + TextBox1.Text + "',edameh='" + CKEditorControl1.Text + "' where idright=" + Label4.Text ;
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();




وقتی کدهای مربوط به سیشن و کوئری را پاک می کنم کد ویرایش کار میکنه
تشکر

korosh00
سه شنبه 05 شهریور 1392, 10:23 صبح
لطفا راهنمایی ؟