本代码也就是 本人的毕业论文。设计课题是:为电力公司做的::温湿度监控器,我主要做 的是 vb与sql的连接。
功能是在sql表中查到用户名和密码。如果输入正确,就进去主界面,现在第一步都做不了。希望高手帮忙。谢谢
Private Sub Command1_Click()
 Dim txtSQL As String, txt1SQL As String
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    Text1.Text = ""
    
  If Trim(Text1.Text = "") Then
        MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
       Text1.SetFocus
    Else
    txtSQL = "select * from wsd where 用户名 = '" & Text1.Text & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = True Then
            MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
           txtUserName.SetFocus
        Else
            If Trim(mrc.Fields(1)) = Trim(Text2.Text) Then
                OK = True
                mrc.Close
                Me.Hide
                Text1.Text = Trim(Text1.Text)
                
                
            Else
                MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
                txtPassword.SetFocus
                txtPassword.Text = ""
            End If
        End If
    End If
    
End Sub



 
											





 
	    

 
	
 
											
