Foros del Web » Programación para mayores de 30 ;) » .NET »

Ayuda con el ERROR..!!!

Estas en el tema de Ayuda con el ERROR..!!! en el foro de .NET en Foros del Web. Hola, por favor necesito que me ayuden, ES MUY IMPORTANTE. me sale este error y no se como solucionarlo: Uno o más errores al procesar ...
  #1 (permalink)  
Antiguo 10/04/2008, 09:24
 
Fecha de Ingreso: marzo-2008
Mensajes: 65
Antigüedad: 16 años, 1 mes
Puntos: 0
Ayuda con el ERROR..!!!

Hola, por favor necesito que me ayuden, ES MUY IMPORTANTE.

me sale este error y no se como solucionarlo:

Uno o más errores al procesar el comando.
Error de sintaxis en {call...} ODBC Escape.
Descripción: Excepción no controlada al ejecutar la solicitud Web actual. Revise el seguimiento de la pila para obtener más información acerca del error y dónde se originó en el código.

Detalles de la excepción: System.Data.OleDb.OleDbException: Uno o más errores al procesar el comando.
Error de sintaxis en {call...} ODBC Escape.

Error de código fuente:


Línea 15: dap.SelectCommand.CommandType = CommandType.StoredProcedure
Línea 16: Dim dst As New DataSet
Línea 17: dap.Fill(dst, "inmobiliaria")
Línea 18: tabla_prin = dst.Tables("inmobiliaria")
Línea 19: Session("tabla_prin") = tabla_prin


Archivo de origen: C:\Documents and Settings\etena\Mis documentos\Visual Studio 2005\WebSites\paginacion\Default2.aspx.vb Línea: 17

ESTE ES EL CODIGO QUE USO EN EL CODEBEHIND:


Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic

Partial Class Default2
Inherits System.Web.UI.Page
Private cn As New OleDbConnection("Provider=MSDAORA;Data Source=NOMBRE;Password=PASSWORD;User ID=USUARIO")
Private tabla_prin As New DataTable 'tabla cargada por el dataset
Private tabla_sec As New DataTable 'tabla donde se muestran los datos segun letra seleccionada

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Using dap As New OleDbDataAdapter("select inmobiliaria,zona from nerea2_inmobiliarias", cn)
dap.SelectCommand.CommandType = CommandType.StoredProcedure
Dim dst As New DataSet
dap.Fill(dst, "inmobiliaria")
tabla_prin = dst.Tables("inmobiliaria")
Session("tabla_prin") = tabla_prin
MostrarGrilla(tabla_prin)
End Using
End If
End Sub

Sub MostrarGrilla(ByVal ta As DataTable)
GridView1.DataSource = ta
GridView1.DataBind()
End Sub

Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
If Session("tabla_sec") Is Nothing Then
MostrarGrilla(Session("tabla_prin"))
Else
MostrarGrilla(Session("tabla_sec"))
End If
End Sub


Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
If e.Row.RowType = DataControlRowType.Footer Then
e.Row.Cells.Clear()
Dim tc As New TableCell
tc.ColumnSpan = "3"
e.Row.Cells.Add(tc)
Dim i As Integer
For i = 65 To 65 + 25
Dim Btn As New Button()
Dim Lit As New LiteralControl()
Lit.Text = " "
Btn.Text = Chr(i)
Btn.CommandName = "AZ"
Btn.CommandArgument = Chr(i)
tc.Controls.Add(Btn)
tc.Controls.Add(Lit)
Next
Dim Btnu As New Button()
Dim Litu As New LiteralControl()
Litu.Text = " "
Btnu.Text = "*"
Btnu.CommandName = "AZ"
Btnu.CommandArgument = ""
tc.Controls.Add(Btnu)
tc.Controls.Add(Litu)
End If
End Sub

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles GridView1.RowCommand
If e.CommandName = "AZ" Then
Dim Filtro As DataRow()
tabla_prin = Session("tabla_prin")

tabla_sec = tabla_prin.Clone() 'solo copio la estructura de la tabla OJO la estructura 'filas y columnas' no todo

Filtro = tabla_prin.Select("inmobiliaria Like '" & e.CommandArgument & "%'") 'se hace el select

For Each FilaEncontrada As DataRow In Filtro ' recorre las filas de filtro
'para ir agregando ah tabla_sec
tabla_sec.ImportRow(FilaEncontrada)
Next

If tabla_sec.Rows.Count > 0 Then
Session("tabla_sec") = tabla_sec
MostrarGrilla(tabla_sec)
Label1.Text = ""
Else
Label1.Text = "No hay datos con: " & e.CommandArgument
End If
End If
End Sub

Sub SelecCells()
LblCells.Text = "inmobiliaria: " & GridView1.SelectedRow.Cells(1).Text & _
" zona: " & GridView1.SelectedRow.Cells(2).Text
End Sub

Sub SelecDataItem()

Dim fila As Integer


Dim r As DataRowCollection 'sus filas
Dim c As DataColumnCollection 'sus columnas

If Session("tabla_sec") Is Nothing Then
tabla_sec = Session("tabla_prin")
Else
tabla_sec = Session("tabla_sec")
End If
r = tabla_sec.Rows
c = tabla_sec.Columns
fila = GridView1.SelectedRow.DataItemIndex 'fila seleccionada de la fuente de datos
LblDataItem.Text = "ID: " & r(fila).Item("inmobiliaria").ToString & _
" Producto: " & r(fila).Item("inmobiliaria").ToString & _
" Precio: " & r(fila).Item("zona").ToString

End Sub

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
SelecCells()
SelecDataItem()
End Sub
End Class
  #2 (permalink)  
Antiguo 10/04/2008, 09:29
Avatar de Peterpay
Colaborador
 
Fecha de Ingreso: septiembre-2007
Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 16 años, 8 meses
Puntos: 87
Re: Ayuda con el ERROR..!!!

Using dap As New OleDbDataAdapter("select inmobiliaria,zona from nerea2_inmobiliarias", cn)
dap.SelectCommand.CommandType = CommandType.StoredProcedure
Dim dst As New DataSet
dap.Fill(dst, "inmobiliaria")


porq si es un query le dices q es un storedprocedure
__________________
Curso WF4
http://cursos.gurudotnet.com/ DF
Aprende HTML5
  #3 (permalink)  
Antiguo 10/04/2008, 09:37
 
Fecha de Ingreso: marzo-2008
Mensajes: 65
Antigüedad: 16 años, 1 mes
Puntos: 0
Re: Ayuda con el ERROR..!!!

HOLA!!! GRACIAS GRACIAS GRACIAS, he quitado esa linea de codigo y me funciona todo a la perfeccion. No sabes como te lo agradezco, estaba ya desesperada que no veia el fallo. MUCHISIMAS GRACIAS, da gusto con gente como tu!
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 04:07.