If Trim(ypsw.Text) = "" Then
創(chuàng)新互聯(lián)秉承實(shí)現(xiàn)全網(wǎng)價(jià)值營銷的理念,以專業(yè)定制企業(yè)官網(wǎng),成都做網(wǎng)站、成都網(wǎng)站制作,微信平臺小程序開發(fā),網(wǎng)頁設(shè)計(jì)制作,手機(jī)網(wǎng)站開發(fā),成都營銷網(wǎng)站建設(shè)幫助傳統(tǒng)企業(yè)實(shí)現(xiàn)“互聯(lián)網(wǎng)+”轉(zhuǎn)型升級專業(yè)定制企業(yè)官網(wǎng),公司注重人才、技術(shù)和管理,匯聚了一批優(yōu)秀的互聯(lián)網(wǎng)技術(shù)人才,對客戶都以感恩的心態(tài)奉獻(xiàn)自己的專業(yè)和所長。
MsgBox("原密碼不能為空!", MsgBoxStyle.Critical)
ElseIf Trim(xpsw.Text) = "" Then
MsgBox("新密碼不能為空!", MsgBoxStyle.Critical)
ElseIf Trim(qpsw.Text) Trim(xpsw.Text) Then
MsgBox("確認(rèn)密碼與新密碼不一致!", MsgBoxStyle.Critical)
Else
Dim mycon As New OleDbConnection
mycon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" Application.StartupPath "\data\Datas.mdb"
mycon.Open()
Dim mycmd As New OleDbCommand
mycmd.CommandText = "select * from 管理員 where 用戶名='admin' and 密碼='" ypsw.Text " '"
mycmd.Connection = mycon
Dim myada As New OleDbDataAdapter
myada.SelectCommand = mycmd
Dim myda As New DataSet
myada.Fill(myda, "yh")
If myda.Tables("yh").Rows.Count 1 Then
MsgBox("您輸入的原密碼不正確,請重新輸入!", MsgBoxStyle.Critical)
ypsw.Focus()
Else
mycmd.CommandText = "update 管理員 set 密碼='" Trim(ypsw.Text) " '"
mycmd.ExecuteNonQuery()
MsgBox("密碼修改成功!", MsgBoxStyle.Information)
End If
End If
汗等等 我最近也在做 我貼代碼吧,這些什么原始密碼和新密碼不是要用戶輸入嘛,我連接的是SQLstring userID = textBox1.Text; //用戶名
string passWorld = textBox2.Text; //密碼
string newpwd = textBox3.Text; //新密碼
Login login1=new Login(); //登陸窗口實(shí)例
if (mima() == 1)
{
SqlConnection mySqlconnection = new SqlConnection(login1.connectionString);
SqlCommand myCommand = new SqlCommand("update Table1 set 密碼='" + newpwd.Trim() + "'where 賬號='" + userID.Trim() + "'and 密碼='" + passWorld.Trim() + "'", mySqlconnection);
mySqlconnection.Open();
int command = myCommand.ExecuteNonQuery();
if (command = 1)
{
if (MessageBox.Show("密碼修改成功,現(xiàn)在馬上去登陸?", "確定", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
mySqlconnection.Close();
this.Close();
login1.Show();
}
}
else
{
mySqlconnection.Close();
MessageBox.Show("用戶不存在或密碼錯(cuò)誤");
}
}
else
{
MessageBox.Show("新密碼不能與舊密碼相同!!");
textBox2.Text = "";
textBox3.Text = "";
textBox2.Focus();
}
以下這里有錯(cuò)誤:
Dim mysqlstr As String = "SELECT * FROM 登錄表 WHERE users='" username " 'AND password='" userpassword " '"
修改為:
Dim mysqlstr As String = "SELECT * FROM 登錄表 WHERE users='" username "' AND password='" userpassword "'"
Dim sql As String = "update DLYZ set 登陸密碼='" + TextBox_xgmm_xdmm.Text.Trim() + "'where 工作證號 ='" + Form1.TextBox1.Text.Trim() + "'"
where前面需要加上空格