Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Object compatibility between VO and VS 20 Jan 2023 15:04 #25023

  • gjbiagiotti
  • gjbiagiotti's Avatar
  • Topic Author


  • Posts: 22
  • I’m developing a class in Visual Studio to handle SQL with PostgreSQL and NpgSql. This class I going use in VO.
    The problem is in the method Select that it return a DataSet object. This object is not compatibily with VO.
    Is there a method in VO that allows both data to be compatible?
    Public oTabla As Npgsql.NpgsqlDataReader

    Public Function PG_Select(ByVal cCadena As String) As Boolean

    ' Devuelve: TRUE error - FALSE sin error

    Dim comando As New Npgsql.NpgsqlCommand

    Try
    comando.Connection = oConexion
    comando.CommandType = CommandType.Text
    comando.CommandText = cCadena

    oTabla = comando.ExecuteReader

    Return False

    Catch ex As Exception
    Return True 'error
    End Try

    End Function

    Thank you
    Gerard

    Please Log in or Create an account to join the conversation.

    Object compatibility between VO and VS 20 Jan 2023 15:18 #25024

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3298
  • Hi Gerard,
    to accomplish that you need to write your own class and expose that to COM.
    You can find a sample here:
    www.riedmann.it/download/PostgreSQLReader.zip
    It is a complete PostgreSQL interface for VO, written in X# and made available to VO through COM (works with SxS, so no registration needed).
    I'm using that library myself, and have similar libraries also for SQLite and MySQL.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Object compatibility between VO and VS 20 Jan 2023 15:39 #25025

    • gjbiagiotti
    • gjbiagiotti's Avatar
    • Topic Author


  • Posts: 22
  • Thanks Wolfgang but I already have a library similar to the one you sent.
    What I am designing is a class library that replaces the VO SQL libraries.
    Thank you.
    Gerard

    Please Log in or Create an account to join the conversation.

    Object compatibility between VO and VS 20 Jan 2023 15:48 #25026

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3298
  • Hi Gerard,
    you should look at the PGDataTable and the PGDataRecord classes in my sample to see how to can expose arbitrary objects to COM.
    If you would like to expose a class similar to the DataSet object you have to write a child class or a proxy class that exposes the needed methods and properties to COM.
    Of course you will need also COM exposed proxy classes for all objects that are returned by your dataset object.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1