freeboy 风云元老 楼主 2006-11-08 01:09 私信 引用 编辑 VB编程题啊 做的是学生信息管理系统,照着书做但出现下面的问题,书也看不明白。请高手帮忙看一下。Quote:运行后提示:“编译错误:未找到方法或数据成员”.是错在下面这个.mnUsertypeWith frmMain.mnUserType = mnUserType.msUsername = userCopy codeOption ExplicitPublic LoginSucceeded As BooleanDim mnUserType As IntegerPrivate Sub optUserType_Click(Index As Integer)mnUserType = IndexEnd SubPrivate Sub Form_Load()optUserType(0).Value = TrueEnd SubPrivate Sub cmdCancel_Click()Unload MeEnd SubPrivate Sub cmdOK_Click()'取得用户输入的用户名和密码Dim user As String, pwd As Stringuser = Trim(txtUser)pwd = Trim(txtPwd)'根据不同的身份,选择不同的表用以查询Dim r As New ADODB.RecordsetSet r = DataEnv.rssqlSeekDim strSQL As StringSelect Case mnUserTypeCase 0: '若身份为管理员strSQL = "select * from 系统人员表 where name=" & user & "and pwd=" & pwd & ""Case 1: '若身份为学生strSQL = "select * from 学生信息表 where name=" & user & " and serial=" & pwd & ""End SelectOn Error Resume Next'查询DataEnv.rssqlSeek的状态,如果已经打开,则先关闭If r.State = adStateOpen Then r.Closer.Open strSQL '根据strSQL的内容刷新DataEnv.rssqlSeek'用户密码错误的次数,如果错误次数超过3次,则退出系统Static nTryCount As IntegerIf r.EOF Then '登录失败MsgBox "对不起,无此用户或者密码不正确!请重新输入!!", vbCritical, "错误"txtUser.SetFocustxtUser.SelStart = 0txtUser.SelLength = Len(txtUser)nTryCount = nTryCount + 1If nTryCount >= 3 ThenMsgBox "您无权操作本系统!", vbCritical, "错误"Unload MeEnd IfElse '登录成功'显示MDI窗体,并将用户类型和用户名传到MDI窗体中的mnUserType, msUserName中With frmMain.mnUserType = mnUserType.msUsername = userEnd WithLoad frmMainfrmMain.ShowUnload MeEnd IfEnd Sub
月老 荣誉会员 #1 2006-11-08 11:40 私信 引用 编辑 书也会出错的,.mnUserType = mnUserType.msUsername = user点前边肯定有东西,VB里好像没这种以点开头的吧! 虽然我已英年早肥,但我仍然很穷!!!黄鱼党|月老欢迎大家光临我爱天使技术论坛!
freeboy 风云元老 #3 2006-11-09 08:23 私信 引用 编辑 Quote:引用第2楼happyangel于2006-11-08 11:49发表的:看了一下,你没定义msUsername我在声明里这样定义Dim mnUserType As Integer,但还是不行啊。。