以下這里有錯誤:
創(chuàng)新互聯(lián)專注于黎川企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站開發(fā),成都商城網(wǎng)站開發(fā)。黎川網(wǎng)站建設(shè)公司,為黎川等地區(qū)提供建站服務(wù)。全流程按需求定制網(wǎng)站,專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)
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 userTable Set 密碼='" TextBox2.Text " ' where 用戶名='" ursename "'"
汗等等 我最近也在做 我貼代碼吧,這些什么原始密碼和新密碼不是要用戶輸入嘛,我連接的是SQLstring userID = textBox1.Text; //用戶名
string passWorld = textBox2.Text; //密碼
string newpwd = textBox3.Text; //新密碼
Login login1=new Login(); //登陸窗口實例
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("用戶不存在或密碼錯誤");
}
}
else
{
MessageBox.Show("新密碼不能與舊密碼相同!!");
textBox2.Text = "";
textBox3.Text = "";
textBox2.Focus();
}
你可以debug將sql語句截出來放到數(shù)據(jù)里運行一下試試sql語句有沒有問題
再有將ds1.Tables.Item(0)改為ds.Tables[0]試試