vb修改access数据

表1里有两个字段用户和密码(里面内容是111)要把内容改为222而且222是在text3.text中输入的请问怎么改呢?在线等
2026年09月15日 23:41
有1个网友回答
网友(1):

VB6新建工程,添加登录对话框,修改其代码,用ADO数据控件连接ACCESS数据库,将txtPassword文本控件的DataSource属性写为ADODC1,属性DataField写为数据表的密码字段名,并将Adodc1的属性ConnectionString中的数据库路径改写为你的数据库路径,代码如下:

Private Sub Form_Load()
Text3 = ""
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtPassword = Text3
Adodc1.Recordset(1) = txtPassword
Adodc1.Recordset.Update
Adodc1.Refresh
End If
End Sub

Private Sub txtUserName_Change()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\biyesheji\mygzs\program\vb\db1.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from userpass where UserName like'" & txtUserName & "%'"
Adodc1.Refresh
txtPassword = Adodc1.Recordset(1)
End Sub