密码问题
事先声明:
Imports System.Data
Imports System.Data.OleDb
――――――――――――――――
Private ds As New DataSet
Private strcon As String = "Provider=SQLOLEDB.1;Data Source=(local);Initial Catalog=数据库名;User ID=sa;Password=sa"
Public DBcon As New OleDbConnection(strcon)
――――――――――――――――
登陆框:
Dim id As String = Trim(TextBox1.Text)
Dim pass As String = Trim(TextBox2.Text)
If id = "" Then
End If
If pass = "" Then
End If
DBcon.Open()
Dim sqlStr As String = "SELECT * FROM TMMLogin where cUserid='" & id & "'"
Dim adt As New OleDbDataAdapter(sqlStr, DBcon)
ds.Clear()
adt.Fill(ds)
DBcon.Close()
If ds.Tables(0).Rows.Count = 0 Then
End If
Dim userid As String = ds.Tables(0).Rows(0).Item("cUserid")
Dim password As String = ds.Tables(0).Rows(0).Item("cPassword")
If password <> pass Then
Else
MsgBox("登陆成功!", MsgBoxStyle.Information, Me.Text)
End If
密码修改:
Dim pass1 As String = Me.TextBox1.Text
Dim pass2 As String = Me.TextBox2.Text
Dim pass3 As String = Me.TextBox3.Text
If pass2 <> pass3 Then
ElseIf pass1 <> G_Password Then
Else
sqlcmd.CommandText = "update B6_reader set password='" & pass2 & "' where readno='" & G_UserName & "'"
DBcon.Open()
sqlcmd.ExecuteNonQuery()
DBcon.Close()
MsgBox("Change Password Success!")
Close()
End If