| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 559 人关注过本帖
标题:各位大哥帮帮手啊.
只看楼主 加入收藏
bingo823
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-3-17
收藏
 问题点数:0 回复次数:2 
各位大哥帮帮手啊.

各位大哥帮帮手啊.我用VB做个系统,但用户密码修改这个窗体的代码老不会编啊,我在网上找了一些,但只有"输入新密码和确认密码"这两项,我想加多一项,请输入旧密码,但就是不知道怎么改啊.我用的是Adodc1.具体代码如下
Option Explicit
Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdok_Click()
'检查各文本框是否为空
If Trim$(txtpassword1.Text) = "" Then
MsgBox "请输入新密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
If Trim$(txtpassword2.Text) = "" Then
MsgBox "请确认新密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
'检查两次输入密码是否相同
If Trim$(txtpassword1.Text) <> Trim$(txtpassword2.Text) Then
MsgBox "确认密码错误,请重新输入!", vbExclamation
With txtpassword2
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
With Adodc1
.RecordSource = "select * from 用户 where 用户名='" & gstruser & "'"
.Refresh
.Recordset("密码") = txtpassword1.Text
.Recordset.Update
End With
MsgBox "密码修改成功!", vbInformation
Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Show
End Sub

Private Sub Label1_Click()

End Sub

搜索更多相关主题的帖子: 密码修改 大哥 确认密码 文本框 用户 
2006-03-17 13:13
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
收藏
得分:0 
以下是引用bingo823在2006-3-17 13:13:00的发言:

各位大哥帮帮手啊.我用VB做个系统,但用户密码修改这个窗体的代码老不会编啊,我在网上找了一些,但只有"输入新密码和确认密码"这两项,我想加多一项,请输入旧密码,但就是不知道怎么改啊.我用的是Adodc1.具体代码如下
Option Explicit
Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdok_Click()
'检查各文本框是否为空
If Trim$(txtpassword1.Text) = "" Then
MsgBox "请输入新密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
If Trim$(txtpassword2.Text) = "" Then
MsgBox "请确认新密码!", vbExclamation
txtpassword1.SetFocus
Exit Sub
End If
'检查两次输入密码是否相同
If Trim$(txtpassword1.Text) <> Trim$(txtpassword2.Text) Then
MsgBox "确认密码错误,请重新输入!", vbExclamation
With txtpassword2
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End If
With Adodc1
.RecordSource = "select * from 用户 where 用户名='" & gstruser & "'"
.Refresh
.Recordset("密码") = txtpassword1.Text
.Recordset.Update
End With
MsgBox "密码修改成功!", vbInformation
Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Show
End Sub

Private Sub Label1_Click()

End Sub


以下的部分代码:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'编写员:梁嘉辉(purana)
'本模块功能:更改用户密码
'最后更新时间:2006-3-17 17:54
'E-Mail:purana@126.com

''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim g_conn As New ADODB.Connection
Dim g_rs As New ADODB.Recordset

Private Sub Form_Load()
Dim connstr As String
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info = False;" _
& "Data Source = " & App.Path & "\demo.mdb"
g_conn.Open connstr
g_rs.CursorLocation = adUseClient
End Sub

Private Sub Form_Unload(Cancel As Integer)
g_conn.Close
Set g_conn = Nothing
End Sub

详细请下载:

vvmeCOAI.rar (9.78 KB) 各位大哥帮帮手啊.



我的msn: myfend@
2006-03-17 18:00
zhglbcheng
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2006-3-21
收藏
得分:0 
不大懂!!!
2006-03-21 14:10
快速回复:各位大哥帮帮手啊.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014416 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved