VB 记录登录名
来源:百度知道 编辑:UC知道 时间:2024/09/20 22:56:18
可以在公共模块中定义几个全局变量,用户登录时将相关值赋给这些全局变量,以后需要显示的时候直接读取这些变量的值即可
在显示的窗体中加个ADODC!
adodc1.recordsourse="select * from 表 where 用户名=“```”‘如果要调用控件的属性要像‘"&label7.cation&"’"这样
adodc1.refresh
lable1.caption=adodc1.recordset.fields(字段名)
``
```
可以在登录后把用户名写入 .ini 文件中,下次登录直接访问这个文件。
新增Module并宣告struser
Public struser As String
---------------------------------
Private Sub cmdlogin_Click()
If txtuser = "" Then
MsgBox "Please fill in User三 Name.", vbInformation + vbOKOnly, "Information"
txtuser.SetFocus
Exit Sub
End If
If txtpassword = "" Then
MsgBox "Please fill in Password.", vbInformation + vbOKOnly, "Information"
txtpassword.SetFocus
Exit Sub
End If
Dim SQL As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "