标题:这样才能够解决这个看四简单的问题
只看楼主
lbclbclbc
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-11-9
 问题点数:0 回复次数:0 
这样才能够解决这个看四简单的问题

我在vb中应用adodb来更新数据库 例如 我想修该密码的操作

Option Explicit Dim textSQl As String Dim msgtext As String Dim cn As ADODB.Connection Dim mrc As ADODB.Recordset Private Sub Form_Load()

Set cn = New Connection Set mrc = New Recordset cn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=学生管理.mdb") cn.CommandTimeout = 10 mrc.Open "登录", cn, adOpenKeyset, adLockPessimistic End Sub

Private Sub Command1_Click() If Trim(Text2.Text) <> Trim(Text3.Text) Then MsgBox "输入密码有错误,请重新输入", 16, "警戒" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text1.SetFocus Else textSQl = "select * from 登录 where 密码= '" & Text1.Text & "'" Set mrc = cn.Execute(textSQl) If mrc.EOF = True Then MsgBox "输入密码有错误,请重新输入", 16, "警戒" Text1.Text = "" Text2.Text = "" Text3.Text = "" Text1.SetFocus Else mrc.Fields(1) = Text2.Text mrc.Update mrc.Close MsgBox "密码修改成功,请继续使用!", 64 + vbOKOnly, "修改成功" Me.Hide cn.Close Set cn = Nothing End If End If End Sub

Private Sub Command2_Click() Unload Me End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command1_Click End If End Sub

结果出现“当前记录集不支持更新。这可能是提供程序的限制,也可能是选定锁定类型的限制”提示

搜索更多相关主题的帖子: Microsoft 数据库 mrc Dim Sub 
2004-12-22 18:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-9878-1-1.html




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

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