VB获取在postgresql中返回函数的游标

时间:2017-11-08 02:56:52

标签: vb.net postgresql odbc

我正在使用postgresql和vb,我想在vb中找到一个返回游标的函数的结果,但是我只能让它返回游标的名字,我不希望这样,但光标数据。

这是代码:

Sub BUSQUEDA(ByRef OBJ As Object, ByVal STR_VALOR As String, ByVal INT_TIPO As Integer, ByVal STR_OPERACION As String)

    Dim CONECTION As New OdbcConnection
    Try
        CONECTION.ConnectionString = ConfigurationManager.ConnectionStrings("SEAU.My.MySettings.FARMACIA_ISABEL_DBConnectionString_64").ConnectionString + ";pwd=xxxxx"

        Dim COMMAND As OdbcCommand = New OdbcCommand(" SELECT SP_BUSQUEDA_DGV('" + STR_VALOR + "'," + CStr(INT_TIPO) + ",'" + STR_OPERACION + "','CURSOR_BUSQ'); " +
                                                         " FETCH ALL IN ""CURSOR_BUSQ"";", CONECTION)

        Dim DA As New OdbcDataAdapter
        Dim DT As New DataTable

        CONECTION.Open()
        DA.SelectCommand = COMMAND
        DA.Fill(DT)
        OBJ = DT
        CONECTION.Close()

    Catch ex As Exception

        If (CONECTION.State = ConnectionState.Open) Then
            CONECTION.Close()
        End If
        Throw ex

    End Try

End Sub

感谢您的帮助

0 个答案:

没有答案