Object compatibility between VO and VS

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
gjbiagiotti
Posts: 33
Joined: Thu Aug 15, 2019 10:16 pm

Object compatibility between VO and VS

Post by gjbiagiotti »

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
User avatar
wriedmann
Posts: 3783
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Object compatibility between VO and VS

Post by wriedmann »

Hi Gerard,
to accomplish that you need to write your own class and expose that to COM.
You can find a sample here:
https://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
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
gjbiagiotti
Posts: 33
Joined: Thu Aug 15, 2019 10:16 pm

Object compatibility between VO and VS

Post by gjbiagiotti »

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
User avatar
wriedmann
Posts: 3783
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Object compatibility between VO and VS

Post by wriedmann »

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
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply