xsharp.eu • Best way to use Microsoft SQL database in X#
Page 1 of 3

Best way to use Microsoft SQL database in X#

Posted: Wed Oct 25, 2023 12:50 pm
by Kees Bouw
Hi Everyone,

Currently I am working on a conversion project to move a VO application to X#. The VO application uses Microsoft SQL Server with Vo2Ado. Of course Xs2Ado is available but is there a "native" X# way to do it? Or perhaps by calling C# code from X#? We are also considering other alternatives like PostgreSQL but for that the database needs to be converted I think. Any advice about the best way to move forward is greatly appreciated.

Kees.

Re: Best way to use Microsoft SQL database in X#

Posted: Wed Oct 25, 2023 1:28 pm
by wriedmann
Hi Kees,
to use SQL Server in X# there are several ways:
- of course you can use XS2ADO, that would save you the time to rewrite the entire database layer
- the "native" way to talk to SQL databases in .NET is ADO.NET
- and you could also use the Entity Framework
If you are rewriting the application completely, i.e. moving to Windows Forms or WPF, I would reccomend ADO.NET, but if you are maintaining the VO GUI classes XS2ADO would be IMHO the best option.
Wolfgang

Re: Best way to use Microsoft SQL database in X#

Posted: Wed Oct 25, 2023 1:31 pm
by wriedmann
Hi Kees,
sorry, I have forgotten about PostgreSQL: that is an entire different database, and has some differences to the Microsoft SQL Server.
PostgreSQL is free to use and open source and works very well: we are using it in VO, X# and PHP projects, and are very happy with our choice.
Wolfgang

Re: Best way to use Microsoft SQL database in X#

Posted: Wed Oct 25, 2023 3:21 pm
by stecosta66
Hi all,

I'm in a similar situation but using PostgreSQL instead of MS Sql Server.
Just finished converting my largest VO application to use PostgreSQL as backend with Vo2Ado.

At the beginning of new year i'm planning to start conversion from Vo to X#.
Any advice on upgrading and use Xs2Ado to shortening development time or use Npgsql .NET Data Provider for PostgrSQL?
Or there is any viable alternative to consider?

Thanks!
Stefano

Re: Best way to use Microsoft SQL database in X#

Posted: Wed Oct 25, 2023 3:54 pm
by wriedmann
Ciao Stefano,
if you would like to keep the migration effort as small as possible, keep XS2ADO. If you have used the VO2ADO RRD for your conversion: it is not available in XS2ADO.
To go with the Npgsql driver you will have to rewrite the data part of your application.
Wolfgang
P.S. I also have a X# COM component for VO that uses the Npgsql driver

Re: Best way to use Microsoft SQL database in X#

Posted: Thu Oct 26, 2023 4:19 am
by stecosta66
Ciao Wolfgang,

thanks for the advice. I've not used Vo2Ado RDD.
Just out of curiosity, Xs2Ado can be compiled in 64bit native as target platform?

Re: Best way to use Microsoft SQL database in X#

Posted: Thu Oct 26, 2023 5:39 am
by wriedmann
Ciao Stefano,
about using XS2ADO in AnyCPU mode I don't know - let's wait what Robert says.
But if you are migrating to X# using the VO GUI classes: they don't work in AnyCPU mode.
To have a VO compatible GUI that runs in AnyCPU (and has support for Unicode) you need the XGUI classes (that are the new VOGUI compatible classes based on Windows Forms). They are included in the subscriber version of X# and should work well starting with X# 2.8. Currently you don't have the bBrowser and ReportPro in these classes.
Wolfgang

Re: Best way to use Microsoft SQL database in X#

Posted: Thu Oct 26, 2023 7:57 am
by robert
Wolfgang, Stefano,

Xs2Ado is designed to be used with the VO GUI classes. These classes do not support AnyCPU/x64.
I have not tried it, but I expect that the classes will also work with anyCPU.

Robert

Re: Best way to use Microsoft SQL database in X#

Posted: Thu Oct 26, 2023 12:29 pm
by stecosta66
Wolfgang, Robert

so I should stick with VO Gui to use Xs2Ado.
Any chance to got it working with the new XGui classes or WinUI?

Thanks!
Stefano

Re: Best way to use Microsoft SQL database in X#

Posted: Thu Oct 26, 2023 12:36 pm
by robert
Stefano,
To make it use with the XGUI classes I would have to create an extra DLL that is compatible with these classes.
Since these classes are not officially ready yet, I have not done that.
But that makes sense.

Robert