求助 vb登入界面
来源:百度知道 编辑:UC知道 时间:2024/09/12 15:18:05
我在添加按钮里输入一下代码:Option Explicit
Dim StrUser As String, StrPass As String, intCount As Integer
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim str As String
str = "select id from yuangongxinxi where id='" & Me.Text2.Text&"'"
str = str & "and name from yuangongxinxi where name = "" & Me.Text1.Text&"""
Set rs = getrs(str)
If IsNull(Me.Text1) Then
MsgBox ("请输入用户名")
ElseIf IsNull(Me.Text2) Then
MsgBox ("请输入密码!")
Else
Me.Visible = False
Form2.Show
End If
exit_Command1_click:
end sub
出现错误 想请vb高手帮忙看看 不胜感激!
数据库我已经连接上了 还是没法运行成功 我没学过vb 不太明白代码是什么意思
还是谢谢大家的帮忙~~
Dim StrUser As String, StrPass As String, intCount As Integer
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim str As String
str = "select id from yuangongxinxi where id='" & Me.Text2.Text&"'"
str = str & "and name from yuangongxinxi where name = "" & Me.Text1.Text&"""
Set rs = getrs(str)
If IsNull(Me.Text1) Then
MsgBox ("请输入用户名")
ElseIf IsNull(Me.Text2) Then
MsgBox ("请输入密码!")
Else
Me.Visible = False
Form2.Show
End If
exit_Command1_click:
end sub
出现错误 想请vb高手帮忙看看 不胜感激!
数据库我已经连接上了 还是没法运行成功 我没学过vb 不太明白代码是什么意思
还是谢谢大家的帮忙~~
你没有和数据库中的表建立连接 yuangongxinxi (员工信息表)
可以这样建立:
Private conn As New ADODB.connection
Dim str1 As String
Dim str2 As String
str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
str2 = "Data Source=*****.mdb;"'此处为待连接的数据库
conn.Open str1 & str2
strSQL = "yuangongxinxi"
rs.Open strSQL, conn, 3, 3
dim conn as new adodb.connection
conn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;password='数据库密码';Initial Catalog=数据库名;Data=本地计算机/服务器
加上这个就OK了