Foros del Web » Programando para Internet » ASPX (.net) »

Asp y oracle

Estas en el tema de Asp y oracle en el foro de ASPX (.net) en Foros del Web. HOLA. LES ESCRIBO POR UN INCONVENIENTE QUE TENGO EN LA CONEXIÓN DE UNA BASE DE DATOS ORACLE CON UN FORM DE VISUAL BASIC (ASPX): RESULTA ...
  #1 (permalink)  
Antiguo 15/08/2008, 09:25
 
Fecha de Ingreso: agosto-2008
Mensajes: 3
Antigüedad: 15 años, 8 meses
Puntos: 0
Asp y oracle

HOLA.


LES ESCRIBO POR UN INCONVENIENTE QUE TENGO EN LA CONEXIÓN DE UNA BASE DE DATOS ORACLE CON UN FORM DE VISUAL BASIC (ASPX):

RESULTA QUE HICE TODO EL FORMULARIO DE REGISTRO DE DATOS, CREÉ LA BASE DE DATOS Y PROGRAMÉ EL BOTÓN PARA QUE GUARDE LOS DATOS; PERO CUANDO EJECUTO ME SALE UN ERROR EN EL MÉTODO FILL(dt) Y NO ENCUENTRO EXPLICACIÓN.

LES AGRADEZCO QUE ME AYUDEN A SOLUCIONAR ESTE PROBLEMA LO MÁS PRONTO POSIBLE, YA SEA CORRIGIENDO ESTE CÓDIGO O CONECTANDO CON ORACLE DE OTRA FORMA.

EL CÓDIGO DEL BOTÓN PARA HACER EL INSERT EN LA BD ES:

------------------------------------------
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.Odbc
Imports System.Data.OracleClient
Partial Class registro
Inherits System.Web.UI.Page
Public da As New OracleDataAdapter
Public dAux As New OracleDataAdapter
Public dt As New DataTable
Dim ds As New DataSet
Public dtAux As New DataTable
Public i As Integer, j As Integer
Public fila As Integer
Public Conexion As String = "Data Source=XE;Password=yayita;User ID=system"
Dim cnn As New OracleConnection(Conexion)
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Dim sSel As String = "SELECT * FROM USU ORDER BY doc_usu"
Try
da = New OracleDataAdapter(sSel, cnn)
Dim cb As New OracleCommandBuilder(da)
cb.QuotePrefix = "["
cb.QuoteSuffix = "]"
da.UpdateCommand = cb.GetUpdateCommand()
da.InsertCommand = cb.GetInsertCommand()
da.DeleteCommand = cb.GetDeleteCommand()
dt = New DataTable
da.Fill(dt)
If dt.Rows.Count > 0 Then
i = dt.Rows.Count - 1
For Me.j = 0 To i
Response.Write(dt.Rows(j).Item(0) & " " & dt.Rows(j).Item(1) & " " & dt.Rows(j).Item(2) & "" & dt.Rows(j).Item(3) & "" & dt.Rows(j).Item(4) & "" & dt.Rows(j).Item(5) & "" & dt.Rows(j).Item(6) & "" & dt.Rows(j).Item(7) & "" & dt.Rows(j).Item(8) & "" & dt.Rows(j).Item(9) & "" & dt.Rows(j).Item(10) & "" & dt.Rows(j).Item(11) & "" & dt.Rows(j).Item(12) & "" & dt.Rows(j).Item(13) & "" & dt.Rows(j).Item(14) & "" & dt.Rows(j).Item(15) & "" & dt.Rows(j).Item(16) & "" & dt.Rows(j).Item(17) & "<br>")
Next j
Else
Response.Write("No hay registros")
End If
Catch ex As Exception
Response.Write("Error en la conexión: " & ex.Message)
End Try
End Sub
Protected Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim sSel As String = "INSERT INTO USU (doc_usu,cod_ul,tipo_usuario,apellido1,apellido2,n ombres, e_mail,feha_nacim, lugar_nacim,direccion,telefono,celular,login, contraseña,pregunta,respuesta,estado_us,semil_idse mil, perfil_prof, objetivo_prof ) VALUES (" & Val(TextBox1.Text) & ",'" & TextBox2.Text & "','" & DropDownList1.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox11.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox12.Text & "','" & TextBox13.Text & "','" & DropDownList2.Text & "','" & TextBox15.Text & "','" & RadioButton2.Text & "','" & TextBox16.Text & "','" & TextBox18.Text & "','" & TextBox19.Text & "')"
da = New OracleDataAdapter(sSel, cnn)
dt = New DataTable
da.Fill(dt)
Response.Redirect("registro.aspx")
End Sub
Private Sub asignarDatos(ByVal dr As DataRow)
dr.Item(0) = Trim(Me.TextBox1.Text)
dr.Item(1) = Trim(Me.TextBox2.Text)
dr.Item(2) = Trim(Me.DropDownList1.Text)
dr.Item(3) = Trim(Me.TextBox3.Text)
dr.Item(4) = Trim(Me.TextBox4.Text)
dr.Item(5) = Trim(Me.TextBox5.Text)
dr.Item(6) = Trim(Me.TextBox6.Text)
dr.Item(7) = Trim(Me.TextBox11.Text)
dr.Item(8) = Trim(Me.TextBox7.Text)
dr.Item(9) = Trim(Me.TextBox8.Text)
dr.Item(10) = Trim(Me.TextBox9.Text)
dr.Item(11) = Trim(Me.TextBox10.Text)
dr.Item(12) = Trim(Me.TextBox12.Text)
dr.Item(13) = Trim(Me.TextBox13.Text)
dr.Item(14) = Trim(Me.DropDownList2.Text)
dr.Item(15) = Trim(Me.TextBox15.Text)
dr.Item(16) = Trim(Me.RadioButton2.Text)
dr.Item(17) = Trim(Me.TextBox16.Text)
dr.Item(18) = Trim(Me.TextBox18.Text)
dr.Item(19) = Trim(Me.TextBox19.Text)
End Sub
End Class
------------------------------------------

LES AGRADEZCO MUCHO LA AYUDA QUE ME PUEDAN BRINDAR Y ESPERO PRONTA RESPUESTA. CHAOOOOOOO
  #2 (permalink)  
Antiguo 15/08/2008, 09:44
Avatar de Peterpay
Colaborador
 
Fecha de Ingreso: septiembre-2007
Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 16 años, 7 meses
Puntos: 87
Respuesta: Asp y oracle

Cuando haces el insert necesitas hacer un Update a tu DataAdapter no un fill.
o hacer

dataAdpater.InsterCommand=sSel;
dataAdapter.Update(dataTable);

pero para q usar dataadapters y datatables si estas haciendo inserts en vivo en vez de agregarlos al datatable.

ojo revisa eso porque no me cuadra tener datatables si haces inserts manuales.
__________________
Curso WF4
http://cursos.gurudotnet.com/ DF
Aprende HTML5
  #3 (permalink)  
Antiguo 22/08/2008, 14:32
 
Fecha de Ingreso: agosto-2008
Mensajes: 3
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Asp y oracle

Gracias Peterpay por tu colaboración:

Estuve revisando y creo que mi problema está en la validación del tipo de datos que se ingresan en el formulario, es decir, que se ingresen datos de tipo varchar2 y los reciba en la base de datos como number. Así que voy a usar los validadores de las herramientas ¡a ver cómo funciona¡

De nuevo gracias. Bye
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:50.