我在 x64 机器上使用 VS2010 和 Oracle 作为我的数据库,但我的 .NET 代码有问题。这里是:
它只是从 DataGrid 选择函数的 web 服务调用的函数。
Public Shared Function get_lista(ByVal i_filtros As CBoletaGarantiaListafiltro, ByVal i_usuario As CUsuario, ByVal i_con As OracleConnection, ByVal i_tran As OracleTransaction, ByRef o_error As CError) As List(Of CBoletaGarantiaLista)
Dim sql As String
sql = " select "
sql = sql & " a.id_proyecto "
sql = sql & " ,a.id_solicitud "
sql = sql & " ,a.fecha_ingreso "
sql = sql & " ,a.usuario_ingreso "
sql = sql & " ,a.estado "
sql = sql & " ,a.cod_motivo "
sql = sql & " ,a.beneficiario "
sql = sql & " ,a.tipo_obra_bol "
sql = sql & " ,a.tipo_plazo "
sql = sql & " ,a.vigencia "
sql = sql & " ,a.monto "
sql = sql & " ,a.codigo_moneda "
sql = sql & " ,a.flex "
sql = sql & " ,a.fecha_esperada "
sql = sql & " ,a.tomador "
sql = sql & " ,b.sdesc tipo_obra_desc "
sql = sql & " ,c.sdesc tipo_plazo_desc "
sql = sql & " ,d.sdesc tomador_desc "
sql = sql & " ,e.sdesc beneficiario_desc "
sql = sql & " ,f.sdesc codigo_moneda_desc"
sql = sql & " ,g.nombre nombre_proyecto"
sql = sql & " ,a.etapa "
sql = sql & " ,h.sdesc estado_desc "
sql = sql & " ,a.glosa "
sql = sql & " ,i.nro_boleta "
sql = sql & " from abd_bol_garantia a "
sql = sql & " , abd_codigos b "
sql = sql & " , abd_codigos c "
sql = sql & " , abd_codigos d "
sql = sql & " , abd_codigos e "
sql = sql & " , abd_monedas f "
sql = sql & " , abd_proyectos g "
sql = sql & " , abd_codigos h "
sql = sql & " , abd_bol_garantia_obtencion i "
sql = sql & " where "
sql = sql & " b.tipo=65 "
sql = sql & " and b.codigo=a.tipo_obra_bol "
sql = sql & " and c.tipo=66 "
sql = sql & " and c.codigo=a.tipo_plazo "
sql = sql & " and d.tipo=67 "
sql = sql & " and d.codigo=a.tomador "
sql = sql & " and e.tipo=68 "
sql = sql & " and e.codigo=a.beneficiario "
sql = sql & " and f.ID_MONEDA=a.codigo_moneda "
sql = sql & " and g.ID_proyecto=a.id_proyecto "
sql = sql & " and h.tipo=71 "
sql = sql & " and h.codigo=a.estado "
sql = sql & " and a.id_solicitud=i.id_solicitud(+)"
If Not i_filtros.estado Is Nothing Then
sql = sql & " and a.estado=:estado "
End If
sql = sql & " and a.vigencia>=:vigencia_ini "
sql = sql & " and a.vigencia<:vigencia_fin "
If Not i_filtros.id_proyecto Is Nothing Then
sql = sql & " and a.id_proyecto=:id_proyecto "
End If
If Not i_filtros.id_solicitud Is Nothing Then
sql = sql & " and a.id_solicitud=:id_solicitud "
End If
sql = sql & " order by a.id_solicitud "
Dim comando As New OracleCommand(sql, i_con, i_tran)
comando.Parameters.Add("vigencia_ini", OracleType.DateTime).Value = i_filtros.fecha_vigencia_ini.Date
comando.Parameters.Add("vigencia_fin", OracleType.DateTime).Value = i_filtros.fecha_vigencia_fin.Date.AddDays(1)
If Not i_filtros.estado Is Nothing Then
comando.Parameters.Add("estado", OracleType.Int32).Value = i_filtros.estado
End If
If Not i_filtros.id_proyecto Is Nothing Then
comando.Parameters.Add("id_proyecto", OracleType.Int32).Value = i_filtros.id_proyecto
End If
If Not i_filtros.id_solicitud Is Nothing Then
comando.Parameters.Add("id_solicitud", OracleType.Int32).Value = i_filtros.id_solicitud
End If
Dim leer As OracleDataReader
leer = comando.ExecuteReader
Dim x_lista As New List(Of CBoletaGarantiaLista)
While leer.Read
Dim a As New CBoletaGarantiaLista
If Not leer.IsDBNull(0) Then
a.id_proyecto = leer.GetInt32(0)
End If
If Not leer.IsDBNull(1) Then
a.id_solicitud = leer.GetInt32(1)
End If
If Not leer.IsDBNull(2) Then
a.fecha_ingreso = leer.GetDateTime(2)
End If
If Not leer.IsDBNull(3) Then
a.usuario_ingreso = leer.GetString(3)
End If
If Not leer.IsDBNull(4) Then
a.estado = leer.GetInt32(4)
End If
If Not leer.IsDBNull(5) Then
a.cod_motivo = leer.GetInt32(5)
End If
If Not leer.IsDBNull(6) Then
a.beneficiario = leer.GetInt32(6)
End If
If Not leer.IsDBNull(7) Then
a.tipo_obra_bol = leer.GetInt32(7)
End If
If Not leer.IsDBNull(8) Then
a.tipo_plazo = leer.GetInt32(8)
End If
If Not leer.IsDBNull(9) Then
a.vigencia = leer.GetDateTime(9)
End If
If Not leer.IsDBNull(10) Then
a.monto = leer.GetDouble(10)
End If
If Not leer.IsDBNull(11) Then
a.codigo_moneda = leer.GetInt32(11)
End If
If Not leer.IsDBNull(12) Then
a.flex = leer.GetInt32(12)
End If
If Not leer.IsDBNull(13) Then
a.fecha_esperada = leer.GetDateTime(13)
End If
If Not leer.IsDBNull(14) Then
a.tomador = leer.GetInt32(14)
End If
If Not leer.IsDBNull(15) Then
a.tipo_obra_desc = leer.GetString(15)
End If
If Not leer.IsDBNull(16) Then
a.tipo_plazo_desc = leer.GetString(16)
End If
If Not leer.IsDBNull(17) Then
a.tomador_desc = leer.GetString(17)
End If
If Not leer.IsDBNull(18) Then
a.beneficiario_desc = leer.GetString(18)
End If
If Not leer.IsDBNull(19) Then
a.codigo_moneda_desc = leer.GetString(19)
End If
If Not leer.IsDBNull(20) Then
a.nombre_proyecto = leer.GetString(20)
End If
If Not leer.IsDBNull(21) Then
a.etapa = leer.GetInt32(21)
If a.etapa = 1 Then
a.etapa_desc = "Aprobacion de Solicitud"
ElseIf a.etapa = 2 Then
a.etapa_desc = "Entrega de Boleta"
ElseIf a.etapa = 3 Then
a.etapa_desc = "Retiro de Boleta"
ElseIf a.etapa = 4 Then
a.etapa_desc = "Devolucion a Tesoreria"
End If
End If
If Not leer.IsDBNull(22) Then
a.estado_desc = leer.GetString(22)
End If
If Not leer.IsDBNull(23) Then
a.glosa = leer.GetString(23)
End If
If Not leer.IsDBNull(24) Then
a.nro_boleta = leer.GetString(24)
End If
x_lista.Add(a)
End While
leer.Close()
Return x_lista
End Function
当我尝试调试它时,我不断收到以下错误消息:
在预期的地方找不到来自关键字
但是当我在 Oracle Toad 和 SQLPLUS 上尝试它时,它运行时没有任何错误。
我是一个新手,但我不应该对这个查询有任何问题......它没有那么复杂,不是吗?
提前致谢