Data access with X# to VFP tables

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
Markus
Posts: 3
Joined: Wed May 19, 2021 5:22 am

Data access with X# to VFP tables

Post by Markus »

Hello all,
we develop a VFP software for social services, it is used by many clients on individual computers. The use of SQL servers is to come in the future, but will rather be something for customers where the data is on a server. For customers with single installations, free VFP tables are still very important. Bit by bit, we want to migrate the software to .Net. To do this, we need access to the VFP tables. Currently, we have developed a VFP-Com server for this purpose, which we use to fetch the data to .Net and also write them back again. The data is loaded via CursorAdapter and transferred via Json or as objects.
Now we have become aware of X# and find it very interesting. Here it is quite easy to load VFP data with a USE and use it in .Net projects. But how does this work technically? Is it the same as in VFP? There are some problems with direct access via USE (e.g. network crashes). What is the best way to load data from VFP tables in X# so that the whole thing also works securely in the network and with access by several users? Is there also something like CursorAdapter or do I not need them at all? Where can I find documentation on this topic?

If X# is a good and secure way of accessing data and if some of the VFP code can be transferred to .Net, that would be a great invention that should be dealt with more intensively.

Many thanks for some beginner input
Markus
RGreim4XS
Posts: 41
Joined: Sat Feb 08, 2020 7:47 am

Data access with X# to VFP tables

Post by RGreim4XS »

Hello Markus,
Wolfgang pointed me to MVVM. Don’t know this is the best option. Why not keep the VFP.com , and do the Rest in X# .
Im also using VFP since FP2.5 Dos, but some say keep VFP some say don’t use it anymore..
Maybe for single user a switch to SQLite would be an option. Or the multiuser version ( Valentina).
For me I have switched to Postgres ( thanks to Wolfang…).


BR Rainer
Markus
Posts: 3
Joined: Wed May 19, 2021 5:22 am

Data access with X# to VFP tables

Post by Markus »

Hello Rainer,

yes, we use .Net (with C#), WPF with MVVM and the EF for a while. I know all that. Our problem is that the VFP application has a lot of forms and we have to convert them to cursor adapters first, then we can switch to another database. At the same time, we want to migrate various modules to .Net, so we need read and write access to the existing VFP tables. Access via Com using our service works, but COM has its own peculiarities (must be registered or requires a manifest) and makes debugging difficult. The idea was therefore to access the VFP data directly from .Net using X#. We would be interested to know how this is technically implemented. Is it also possible internally via COM or are the tables opened directly as files? How reliably does this work (also multi-user and network)? Does anyone have experience? If X# is not an alternative, we will stay with the VFP ComService.

Many thanks
Markus
RGreim4XS
Posts: 41
Joined: Sat Feb 08, 2020 7:47 am

Data access with X# to VFP tables

Post by RGreim4XS »

Hallo, Markus, sounds like a lot of work, hope you have plugins/ wizards to help you.
And hope it’s more than bringing VFP SW to .net.
BR Rainer
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Data access with X# to VFP tables

Post by robert »

Markus,
The VFP data access in X# works through a native X# data access layer (which we call RDD). This is written in X# of course.
We have added what we call "User Defined Commands" that translate the familiar VFP commands such as USE, SKIP, SCAN etc to function calls which in their turn call methods from the RDD layer.
About the reliability for multi user and in a network: this is just as reliable or unreliable as VFP.
You have to make sure that the caching parameters for shared file access are set correctly at every workstation that opens and updates a file.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Data access with X# to VFP tables

Post by wriedmann »

Hi Markus,
about the architecture of the DBF access in X#: as you may know, X# comes from VO and like Clipper 5 and VO it implements data access to DBF tables using so called RDDs (Replaceable Database Driver).
Then there is the functional layer like Clipper had it.
Over this, using the powerful preprocessor, there are both a class layer with the DBServer class (from VO) and a command layer like Clipper and VFP with "use area".
Since I'm a VO guy and have absolutely no knowledge about VFP, maybe others can explain you better what you can do.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Markus
Posts: 3
Joined: Wed May 19, 2021 5:22 am

Data access with X# to VFP tables

Post by Markus »

Hello and thank you for the answers!

Since I have absolutely no idea about VO, these statements rather motivate me to continue with my own VFP service. Or are there VFP developers here who already have experience with data access to native VFP tables using X#? Does anyone do this and already have practical experience?

Many thanks
Markus
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Data access with X# to VFP tables

Post by wriedmann »

Hi Markus,
maybe it is better to show a few lines of code to see how you would like to access your tables from your application. Then someone could step in and says how this can work with X#
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply