vb编程,设计一个登录模块,在text控件输入用户名和密码,然后点击commond控件,其中怎么和数据库联通的?

来源:百度知道 编辑:UC知道 时间:2024/06/06 12:50:49
text控件中的内容怎么传到sql数据库中,然后又怎么把数据库中的数据导出来了,代码是什么样的,让我参考下

给你一段以前我编写登录界面代码,自己琢磨去吧

Dim sql As String
Dim yhm As String

Private Sub Command1_Click()
If opt2.Value = True Then
sfjyw = True
serverpath = GetValue(app.Path & "\Config.ini", "serverpath", "serverpath", Trim(Text2.Text))
End If

On Error GoTo xx
If Me.Combo1.Text = "" Then
MsgBox "请选择登陆用户!", 48, "错误提示"
Exit Sub
End If
Call OpenConn
sql = "select * from xtyh where name='" & Me.Combo1.Text & "'"
rs.Open sql, cn, 1, 1

If zhuan(txtMM.Text) = IIf(Trim(IsNull(rs.Fields("pass"))), "", Trim(rs.Fields("pass"))) Then
czy = rs.Fields("name")
czyqx = rs.Fields("czdj")
Call CloseConn
Formmain.Show
Unload Me
Else
MsgBox "密码错误!", 48, "错误提示"