SQL Example to get local Cursor???

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Anonymous

SQL Example to get local Cursor???

Post by Anonymous »

Can someone give me a simple code example to send a query to SQL Server and get a local Cursor of records?
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

SQL Example to get local Cursor???

Post by lumberjack »

Hi Matt,
FoxProMatt_MattSlay wrote:Can someone give me a simple code example to send a query to SQL Server and get a local Cursor of records?
I use DataTable as my local cursors

Code: Select all

var cmd := SQLCommand{"select * from <table>", oConn}
cmd:Connection:Open()
var dataReader := cmd:ExecuteReader()
var dataTable := DataTable{}
dataTable:Load(dataReader)
______________________
Johan Nel
Boshof, South Africa
FoxProMatt

SQL Example to get local Cursor???

Post by FoxProMatt »

I’m looking for work areas or cursors, like FoxPro, not .Net data tables.
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

SQL Example to get local Cursor???

Post by wriedmann »

Hi Matt,

the VO SQL classes have a SQLSelect and a SQLTable class for this, and therefore they are also in the current X# VO compatible libraries. But in VO they don't open up a workarea, they are objects that can be connected to a datawindow or databrowser.

To have such a functionality in X# you'll have to wait for the development team to build these classes (for the FoxPro runtime).

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

SQL Example to get local Cursor???

Post by lumberjack »

Hi Wolfgang/Matt,
wriedmann wrote: the VO SQL classes have a SQLSelect and a SQLTable class for this, and therefore they are also in the current X# VO compatible libraries. But in VO they don't open up a workarea, they are objects that can be connected to a datawindow or databrowser.
To have such a functionality in X# you'll have to wait for the development team to build these classes (for the FoxPro runtime).
If my memory serves me right, Robert indicated that the idea would be to have a "cursor" type wrapped around DataTable, hence why I suggested DT. Otherwise, probably a bit of a rework of ArrayServer or bArrayServer might be the solution...
______________________
Johan Nel
Boshof, South Africa
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

SQL Example to get local Cursor???

Post by wriedmann »

Hi Johan,

anyway - currently there is no way, since there is no FoxPro compatible runtime.
And it can take some time as it is a lot of work.... and IMHO it makes not too much sense to spend now time in these functionalities if other more basic FoxPro languages features are to be implemented.
As you know, development time is always too short.... Robert could easily quadruplicate his time, and it would always not be enough.
Wolfgang
P.S. as you know, I'm doing in X# what I see as possible (the last time a extension to Combit cRM), but I'm ways behind my plan to migrate my VO applications to X#
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SQL Example to get local Cursor???

Post by robert »

Matt,
Wofgang is right. This is NOT in the product yet.
In VO we have an OOP layer on top of workareas and another OOP layer on the SQL API.

We are planning to support the FoxPro SQL.. functions and select the resulting data in a DataTable/DataView (like Johan said) and use this as data for a workarea. A SQL RDD you could call this. This will be part of the FoxPro runtime.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

SQL Example to get local Cursor???

Post by lumberjack »

Hi Wolfgang,
wriedmann wrote: anyway - currently there is no way, since there is no FoxPro compatible runtime.
Fully agree, and hence why I try and stay away from XBase style interfaces if there is an alternative .NET feature. It is less work in the end to rather create wrappers around XBase style features, e.g. DBFToDataTable() etc. to not keep you bound to VO classes.
And it can take some time as it is a lot of work.... and IMHO it makes not too much sense to spend now time in these functionalities if other more basic FoxPro languages features are to be implemented.
As you know, development time is always too short.... Robert could easily quadruplicate his time, and it would always not be enough.
I know and I appreciate what Robert is doing, feels sometimes even when I try to assist as if I do not have the capability of assisting...
P.S. as you know, I'm doing in X# what I see as possible (the last time a extension to Combit cRM), but I'm ways behind my plan to migrate my VO applications to X#
I know, it is quite a balance between keeping software running and migrating to .NET/X#
______________________
Johan Nel
Boshof, South Africa
FoxProMatt

SQL Example to get local Cursor???

Post by FoxProMatt »

Indeed, my interest was to explore X sharp from an Xbase programming style. I just wasn’t sure if the recent work with had brought it to that stage yet.

I know there are .net alternatives but since XSharp is billed as an X base replacement candidate, I want to work at it from the xBase perspective to see what limits it runs into.

I’ll keep waiting and maybe the September release may have this capability.
Post Reply