我帶來了簽名者信息。更新時出現問題。如何更新會話
這裏我的代碼:
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("~/App_Data/Database.mdb"));
protected void Page_Load(object sender, EventArgs e)
{
baglanti.Open();
var ID = Session["id"];
OleDbCommand komut = new OleDbCommand("select *from tablo1 where id=" + ID + "", baglanti);
komut.Parameters.AddWithValue("id", TextBox6.Text);
OleDbDataReader oku = komut.ExecuteReader();
if (oku.Read())
{
TextBox1.Text = oku["isim"].ToString();
TextBox2.Text = oku["soyisim"].ToString();
TextBox3.Text = oku["kadi"].ToString();
TextBox4.Text = oku["sifre"].ToString();
TextBox5.Text = oku["email"].ToString();
}
}
,並
protected void Button1_Click(object sender, EventArgs e)
{
//update
var ID = Session["id"];
OleDbCommand komut = new OleDbCommand("update tablo1 set [email protected],[email protected],[email protected],[email protected],[email protected] where id=" + ID + "", baglanti);
komut.Parameters.AddWithValue("@isim", TextBox1.Text);
komut.Parameters.AddWithValue("@soyisim", TextBox2.Text);
komut.Parameters.AddWithValue("@kadi", TextBox3.Text);
komut.Parameters.AddWithValue("@sifre", TextBox4.Text);
komut.Parameters.AddWithValue("@email", TextBox5.Text);
komut.ExecuteNonQuery();
baglanti.Close();
}
不updating.I我選擇datas.But的button1_Click犯規工作。
** **警告你的代碼很容易受到SQL注入攻擊。 –