Conexión de VB a Oracle

Lupita
03 de Marzo del 2005
Hola!!
Mi problema es el siguiente: Resulta ke necesito realizar una conexión a oracle desde un sistema ke esta creado en visual 6.0 pero no sé como realizarla.
Si alguien pudiera enviarme el código para realizar dicha conexión se lo agradecería mucho.

ca
03 de Marzo del 2005
***Con el oledb de oracle
db.Open "Provider=OraOLEDB.Oracle.1;Password=clave ;Persist Security Info=True;User IDusuario;Data Source=base de datos"
***Con el oledb de Microsoft db.Open "Provider=OraOLEDB.Oracle.1;Password=clave ;Persist Security Info=True;User IDusuario;Data Source=base de datos"

Te recomiendo El de Oracle

Lupita
03 de Marzo del 2005
Hola!!
Aprovechando de tu ayuda, podrias enviarme un ejemplo de como utilizas el recordset. es decir, como realizas consultas y demas operaciones en oracle, por favor!!

Caceres
03 de Marzo del 2005
Public db As New ADODB.Connection
Public rstabla2 As ADODB.Recordset
Public uid As String
Public pwd As String
Public d_Base As String
Dim total As Double
Private Sub CmdConsultar_Click()
total = 0
Set rstabla = New ADODB.Recordset
monto = "0"
R = "103"
m = "107"
MousePointer = vbHourglass
' db.Execute "insert into nomina (empleado,sueldo) values('" & codigo & "'," & sdo & ")", afectados

rstabla.Open "select c.empleado,e.nombre,n.periodo,c.concepto , Sum(c.monto), Sum(c.total) from empleado_conc_nomi c,empleado e,nomina_historico n where c.concepto in ('" & R & "','" & m & "') and c.numero_nomina = n.numero_nomina and c.empleado = e.empleado and n.periodo between '" & Format(CbFecha1.Value, "yyyy-mm-dd") & "' and '" & Format(CbFecha2.Value, "yyyy-mm-dd") & "') group by e.departamento,c.empleado,e.nombre,n.periodo,c.concepto order by e.departamento,c.empleado,n.periodo,c.concepto", db, adOpenStatic, adLockReadOnly
Set Grid.ADORecordset = rstabla
Grid.Columns(1).Width = 2900
Grid.Columns(2).Width = 2700
Grid.Columns(3).Width = 1550
Grid.Columns(4).Width = 1200
If rstabla.RecordCount = 0 Then
MsgBox ("No se Encontro Ningun Registro" & vbCrLf & "Revise lo Parametros"), vbExclamation
Else
If rstabla.RecordCount > 0 Then
Do While Not rstabla.EOF
total = total + rstabla!monto
rstabla.MoveNext
Loop
End If
End If
MousePointer = vbNormal
Exit Sub
Error:
MousePointer = vbNormal
MsgBox ("Se ha Producido Un Error " & vbCrLf & "NO." & Err.Number & vbCrLf & Err.Description), vbCritical

End Sub
Private Sub Form_Load()
CbFecha1.Value = Date
CbFecha2.Value = Date
On Error GoTo Error

Screen.MousePointer = vbHourglass
'On Error GoTo logonError
'Set gDmsg = New OmsgBox.DMsgBox
Dim Conn As String
'Dim drv As String
uid = "ageport"
pwd = "ageport"
d_Base = "Exactus"
Set db = New ADODB.Connection
db.CursorLocation = adUseClient
'MsgBox ("Conexion Exitosa"), vbInformation
Screen.MousePointer = vbHourglass
'db.Open "FILE NAME=" + App.Path + "conexion.udl"
db.Open "Provider=OraOLEDB.Oracle.1;Password=" & pwd & " ;Persist Security Info=True;User ID=" & uid & ";Data Source=" & d_Base & ""

' Conn = "UID= " & uid & ";PWD=" & pwd & ";DRIVER={Microsoft ODBC For Oracle};" _
' & "SERVER=" & d_Base & ";"
' Conn = "UID= " & uid & ";PWD=" & pwd & ";DRIVER={Microsoft ODBC For Oracle};"
' 'End If
'drv = "Microsoft ODBC For Oracle"
' With db
' .ConnectionString = Conn
' .CursorLocation = adUseClient
' .Open
' End With
'' If db.State = 1 Then MsgBox ("Conexion Exitosa"), vbInformation
'' If db.State = 0 Then MsgBox ("Conexion Fallida"), vbInformation
' Conn = "UID= " & uid & ";PWD=" & pwd & ";DRIVER={Microsoft ODBC For Oracle};" _
' & "SERVER=" & d_Base & ";"
' 'Conn = "UID= " & uid & ";PWD=" & pwd & ";DRIVER={Microsoft ODBC For Oracle};"
'
' drv = "Microsoft ODBC For Oracle"
' With db
' .ConnectionString = Conn
' '.CursorLocation = adUseClient
' .Open
' End With
' If db.State = 1 Then MsgBox ("Conexion Exitosa"), vbInformation
Screen.MousePointer = vbDefault
'FrmRetenciones.Show
'If db.State <> 1 Then MsgBox ("Error De conexion")
'FrmPrincipal.StatusBar1.Panels(1).Text = "Usuario: " & uid
Error:
If Err.Number <> 0 Then
Screen.MousePointer = vbDefault
If Err.Number = -2147217843 Then MsgBox ("Usuario ó Password Incorrecto"), vbCritical
If Err.Number = -2147467259 Then MsgBox ("Error De Acceso Al Sistema " & vbCrLf & "Verifique El Registro De Entrada" & vbCrLf & "Sino Llame al Administrador "), vbCritical

' With frmLogOn
' .txtUserId.Text = ""
' .txtPwd.Text = ""
' .txtDb.Text = ""
' .txtUserId.SetFocus
' End With
Else

Screen.MousePointer = vbDefault

'Unload frmLogOn

End If