十万火急!!!新手在VB登录中遇到的问题,望高人指点

来源:百度知道 编辑:UC知道 时间:2024/05/17 22:30:46
我是VB菜鸟,在做一个小程序的时候登录界面的登录按钮写了如下代码。
运行提示 要求对象 希望高手们帮我看看
我用的SQL2000server 表里的字段为 userID , password
急急急!!! 先多谢了 !!

Adodc1.RecordSource = "select * from 用户表 where userID = '" & Text1 & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "对不起,该用户不存在!", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
If Adodc1.Recordset.Fields("password") = Text2 Then
功能界面.Show
Else
MsgBox "对不起,你输入的密码不正确!", vbInformation + vbOKOnly, "提示"
End If

这个……怎么说,这个登陆界面有些简陋了阿。
附上我自己做的登陆界面代码,用的是Access(基本和SQL没区别,路径记得改下),连接方式用的是Adodb(强烈建议不要受毒害用那个Adodc,不方便而且麻烦。。。)
代码如下(好长的,慢慢看,我有加注释的)
Option Explicit
Dim id As String
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim db As String
Dim ch As String '全局变量定义
Private Sub Command1_Click()
'在SQL中核对是否有雷同的帐号,并作出相应的回应
Dim foundresult As String
On Error GoTo Adderr '打开错误陷阱
db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB设计及SQL开发\DKP管理系统.mdb;Persist Security Info=False"
conn.Open db
id = Text1.Text
If Len(Text1.Text) < 3 Then '用户名长度检定
If Text1.Text = "" Then
MsgBox "用户名不能为空!", vbCritical
Else
MsgBox "用户名过短,请重新输入!", vbExclamation
Text1.Text = ""
End If
Else '用户名在数据库中的对应检定
foundresult = "SELECT count(*) FROM Player_ID_Password WHERE Player_ID like '