If re.State = adStateOpen Then ’还是我胆小怕它出错,加了这条 re.Close End If re.ActiveConnection = cnn re.CursorLocation = adUseClient re.CursorType = adOpenDynamic re.LockType = adLockBatchOptimistic re.Open "select *from 用户管理 where 用户名='" & Form2.Text1.Text & "'" re("密码") = Trim(Text1.Text) re.UpdateBatch re.Close cnn.Close MsgBox "密 码 修 改 成 功!", , "修改密码" Unload Me End If End If End Sub
不绑定控件,用下面的方法: Private Sub Command1_Click() 连库就省了,,, with Recordset(记录的名称) .addNew !fileds(字段名称)= Text1.text ..... ,updata end with
Dim cnn As New ADODB.Connection
Dim re As New ADODB.Recordset
Dim stryh As String
If cnn.State = adStateOpen Then ‘我胆小怕它出错,就加了这条
cnn.Close
End If
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 这里是路径;Jet OLEDB:Database Password=密码;Persist Security Info=true"
If re.State = adStateOpen Then ’还是我胆小怕它出错,加了这条
re.Close
End If
re.ActiveConnection = cnn
re.CursorLocation = adUseClient
re.CursorType = adOpenDynamic
re.LockType = adLockBatchOptimistic
re.Open "select *from 用户管理 where 用户名='" & Form2.Text1.Text & "'"
re("密码") = Trim(Text1.Text)
re.UpdateBatch
re.Close
cnn.Close
MsgBox "密 码 修 改 成 功!", , "修改密码"
Unload Me
End If
End If
End Sub
Private Sub Command1_Click()
连库就省了,,,
with Recordset(记录的名称)
.addNew
!fileds(字段名称)= Text1.text
.....
,updata
end with