Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/11/2007, 13:15
Avatar de Drako_18
Drako_18
 
Fecha de Ingreso: mayo-2005
Ubicación: Madrid
Mensajes: 505
Antigüedad: 19 años
Puntos: 16
Re: Conexion a oracle 9

PREGUNTA: ¿Como haría para realizar una consulta o para insertar datos?


RESPUESTA:
- Simplemente realizando lo siguiente:
'IMPORTACIONES...
Imports System.Data.OracleClient
Imports System.Data


Dim sCadenaConexion AsString = _
"Data Source=MIBASEDEDATOS;User Id=USUARIO;Password=CONTRASEÑA"
Dim oConexion AsNew OracleConnection(sCadenaConexion)

oConexion.Open()


If oConexion.State() = ConnectionState.Open Then
'SI LA CONEXION ESTA HABIERTADim oComando As OracleCommand

oComando = New OracleCommand("INSERT INTO TABLA VALUES(434)", oConexion)

'SI oComando NO CONTIENE UN SELECT.
oComando.ExecuteOracleNonQuery("")

'SI oComando CONTIENE UN SELECT...
oComando = New OracleCommand("SELECT * FROM ALUMNOS", oConexion)

'EL COMANDO A UTILIZAR ES EL SIGUIENTE...
Dim oLineas As OracleDataReader
oLineas = oComando.ExecuteReader()

'OTRAS OPERACIONES...

EndIf
__________________
Rubén Espada
Desarrollador full stack .Net (Angular + JS + .Net Core)

Última edición por Drako_18; 12/11/2007 a las 15:07 Razón: MEJORA DEL CONTENIDO DE ESTE HILO