Jump to content


Photo

Urgente - Login Naum Funfo


  • Faça o login para participar
1 reply to this topic

#1 x-webmaster

x-webmaster

    Mestre

  • Usuários
  • 638 posts
  • Sexo:Não informado
  • Localidade:SP SP

Posted 18/07/2003, 19:45

Ae galera....... tipo se vc erra o login a primeria vez depois se tenta de novo ele naum funfa pq?:

  'General
   Dim conConnection As ADODB.Connection
    Dim recRecordset As ADODB.Recordset
    Dim strUsuarioValido

Private Sub cmdEntrar_Click()
strUsuarioValido = "Nao"
If Not recRecordset.EOF Then
    Do While Not recRecordset.EOF
    If txtNome.Text = recRecordset.Fields("Login").Value And txtSenha.Text = recRecordset.Fields("Senha") Then
    strUsuarioValido = "Sim"
    Exit Do
        End If
        recRecordset.MoveNext
    Loop
        If strUsuarioValido = "Sim" Then
        Form2.Show
        Else
        strUsuarioValido = "Nao"
        MsgBox ("Senha incorreta")
  End If
End If
End Sub

Private Sub Form_Load()
  Set conConnection = New ADODB.Connection
    With conConnection
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Guilherme\Meus documentos\projetos\login.mdb;Persist Security Info=False"
        .Open
    End With
    
    Set recRecordset = New ADODB.Recordset
    With recRecordset
        .ActiveConnection = conConnection
        .CursorType = adOpenStatic
        .CursorLocation = adUseClient
        .LockType = adLockOptimistic
        .Source = "SELECT * FROM login"
        .Open
    End With
Text1.Text = recRecordset.Fields("Login").Value
End Sub



URGENTE!!!!!!!!!!!!!!!!

#2 Darkness

Darkness

    Om Mani Padme Hum

  • Usuários
  • 199 posts
  • Sexo:Não informado
  • Localidade:sao paulo
  • Interesses:gosto de informatica td q eh relacionado a essa area<br>e tb curto jogar bola

Posted 02/08/2003, 01:00

ai cara esse seu codigo nao sei no que vc esta usando mas se for soh para login tente esse, cmg da certo


Private Sub Senha_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Senha = "" Then
MsgBox "Digite a senha de acesso."
Senha.SetFocus
Exit Sub
Else
SendKeys "{tab}"
End If



Dim areatrabalho As Workspace
Dim query As String
Dim xxbco As Database

Set areatrabalho = DBEngine.Workspaces(0)
Set xxbco = areatrabalho.OpenDatabase(App.Path & "\senha.mdb", False, False)
query = "select * from Cadastro where S1='" & nomeusu & "'"
Set dyn = xxbco.OpenRecordset(query)
If Not dyn.EOF Then
If Senha <> dyn("S2") Then
MsgBox "Senha não confere."
Senha = ""
Senha.SetFocus
Exit Sub
Else
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Manutencao.Command1.Enabled = True
If nomeusu = "administrador" And Senha = dyn("s2") Then
Manutencao.Command4.Enabled = True
End If
End If
Else
MsgBox "Nome de Usuário não confere."
nomeusu.SetFocus
End If
xxbco.Close
End If

End Sub


:D
"Os fracos se vingam os fortes tem o dom de perdoar"




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq