Delphi - ayuda con BV6.0

 
Vista:

ayuda con BV6.0

Publicado por Martha  (1 intervención) el 20/08/2009 17:52:19
Hola! tengo problemas con un trabajo lo quepasa es que no me habre la base de datos no se cual seria en este caso el problema est es el codigo fuente:

modulo principal:
Option Explicit
Public CadenaSQL As String
Public cnn As ADODB.Connection
Public rst As ADODB.Recordset
Public Rutabd As String
Public conectarADO As String

Sub Main()
frmlogin.Show vbModal
End Sub

Public Function buscarrutabd()
Rutabd = App.Path & "facturacion.mdb"
End Function

Public Sub AbrirMainDB()

On Error GoTo errCtrl

'conectarADO = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=FACTURACION;Data Source=TRABAJO"
conectarADO = "provider=microsoft.jet.oledb.4.0;data source=" & buscarrutabd
Set cnn = New ADODB.Connection
With cnn
.ConnectionString = conectarADO
.Open
End With
ExitHere:
Exit Sub
errCtrl:
MsgBox Err.Description
End Sub

y el codigo del formulario es :
Option Explicit

Private Sub cmdingresar_Click()

Dim pwd As String
Dim id As String

id = Me.txtident.Text
pwd = Val(Me.txtpas.Text)

Set rst = Nothing
Set rst = New ADODB.Recordset

CadenaSQL = "select * from usuario" & " where Usuario ='" & id & "'" _
& " and Password= " & pwd & ""

With rst
.Source = CadenaSQL
.ActiveConnection = cnn
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With

If Not rst.EOF Then

If id = rst.Fields(" Usuario") And pwd = rst.Fields("Password") Then
MsgBox " Bienvenido Sr.(a)", vbExclamation, " Iniciando de Secion"
Unload frmSplash
MDIsistema.Show

Else
If (id = "" Or pwd = "") Then
MsgBox " Sr. Usuario Ingrese sus datos", vbInformation + vbCritical, "Inicio de Secion"
Me.txtident.SetFocus

Else
If (pwd = "") And (id = rst.Fields("Usuario")) Then
MsgBox "Sr.Usuario no Ingreso la Contraseña, Escriba la contraseña", vbInformation, "Escriba la contraseña de usuario"
Me.txtpas.SetFocus
Else
If (id = "") And (pwd = rst.Fields("Password")) Then
MsgBox "Sr.Usuario ingrese su nombre de usuario, Escriba la contraseña", vbInformation, "Escriba la contraseña de usuario"
Me.txtpas.SetFocus

Else
If (pwd <> rst.Fields("Password")) And (id = rst.Fields("usuario")) Then
MsgBox "Contraseña no válida. Intente de Nuevo ", vbInformation, " Escriba la contraseña correcta"
Me.txtpas.SetFocus
Else
If (id <> rst.Fields("usuario")) And (pwd = rst.Fields("Password")) Then
MsgBox "Nombre de usuario no válido. Intente de Nuevo ", vbInformation, "Escriba el nombre de Usuario Correcto"
Me.txtident.SetFocus

End If
End If
End If
End If
End If
End If
End If

End Sub

Private Sub cmdsalir_Click()
End
End Sub

Private Sub Form_Load()
Label2 = Date
AbrirMainDB
End Sub

Private Sub txtident_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.txtpas.SetFocus
KeyAscii = 0
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End Sub

Private Sub txtpas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Me.cmdingresar.SetFocus
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If

el error que me manda es : error de autenticacion
desde ya gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder