 |
|
หลักการของผมที่เขียนมันคือการ Update ไม่รู้ว่าจะใช้หรือป่าว
ใส่รหัสทั้ง 2 ตรงกันแต่มันก็ฟ้อง MessageBox ไม่เข้าใจจริงๆ ครับ
Code (C#)
private void changepassword()
{
if ((txtoldpwd.Text == "") || (txtnewpwd.Text == ""))
{
MessageBox.Show("กรุณากรอกข้อมูลให้ครบ", "Check", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
string ConnStr = Properties.Settings.Default.DatabaseCarserviceConnectionString;
using (OleDbConnection conn = new OleDbConnection(ConnStr))
{
string sql = "UPDATE [Employee] set Emp_User='" + txtusername.Text + "',";
sql += "Emp_Password='" + txtconfirm.Text + "' ";
sql += "WHERE Emp_ID='" + txtCusID.Text + "' ";
conn.Open();
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
{
cmd.ExecuteNonQuery();
};
string strCmd = "SELECT * FROM Employee ORDER BY Emp_ID";
OleDbDataAdapter da = new OleDbDataAdapter(strCmd, conn);
DataSet ds = new DataSet();
da.Fill(ds);
};
}
}
private void btnsave_Click(object sender, EventArgs e)
{
if (txtnewpwd != txtconfirm)
{
MessageBox.Show("Password ไม่ตรงกัน กรุณากรอกใหม่", "Check", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
changepassword();
InPassCorrect();
}
}
Tag : .NET, Ms Access, Win (Windows App), C#, Windows
|
|
 |
 |
 |
 |
Date :
2012-08-17 07:51:27 |
By :
peteyothin |
View :
1382 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |