Conexion con db2

Solo disponible en BuenasTareas
  • Páginas : 2 (303 palabras )
  • Descarga(s) : 0
  • Publicado : 23 de marzo de 2011
Leer documento completo
Vista previa del texto
Option Explicit

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public Usuario As String
Public Password As StringPublic Administrador As String
Public Llave1 As String
Public Llave2 As String
Public Llave3 As String
Public Llave4 As String
Public Llave5 As String
Public Llave6 As String
Public Proceso AsString
Public xrow As Integer

Public db As New adodb.Connection
Public RS As New adodb.Recordset
Public Files_OK As Object
Public Files As Object
Public StrSql, status As String

PublicLibreria As String
Public mensaje

Public Sub Conectar()
On Error Resume Next
Dim sBuffer As String
Dim lSize As Long
Libreria = "DC@RNSLIB"
'Libreria = "DC@DESLIB"
Set db =New adodb.Connection
db.CursorLocation = adUseClient 'Modo Acceso

If db.State = adStateOpen Then
db.Close
End If
db.ConnectionTimeout = 0
db.CommandTimeout = 0'db.Open "PROVIDER=MSDASQL;dsn=DESARROLLO;UID=" & Usuario & ";PWD=" & Password & ";"
db.Open "PROVIDER=MSDASQL;dsn=PRODUCCION;UID=" & Usuario & ";PWD=" & Password & ";"
If db.State =adStateClosed Then
MsgBox " Lo Siento, USUARIO ó CLAVE no valido"
Password = ""
Exit Sub
End If
Set Files_OK = New Recordset

StrSql = "Select * from " & Libreria & ".MMUSERWhere MMCUSR = '" & Usuario & "'"
Files_OK.Open StrSql, db, adOpenStatic, adLockOptimistic

If (Files_OK.BOF Or Files_OK.EOF) Then
MsgBox " Lo Siento, USUARIO no registrado es elsistema AS/400"
Password = ""
End If
Files_OK.Close

End Sub

Public Function DuplicarComillas(istrCadena As String) As String
'Duplica las comillas de una cadena
'Se puede usarpara insertar o actualizar comillas con una cadena SQL ya que tienen
'un significado especial

Dim strcadena As String, strLetra As String
Dim lngCadaLetra As Long
Const strComilla =...
tracking img