maybe it is a linq call for loading the VFP data into a .NET friendly data object?
Here is a how to do it in the OLD days of LINQ. This would give you the dataobject you would foreach() through.
using System.Data; using System.Data.OleDb; public class YourClass{ public DataTable GetYourData() { DataTable YourResultSet = new DataTable();
OleDbConnection yourConnectionHandler = new OleDbConnection( "Provider=VFPOLEDB.1;Data Source=C:\SomePath\;" );
// if including the full dbc (database container) reference, just tack that on// OleDbConnection yourConnectionHandler = new OleDbConnection(// "Provider=VFPOLEDB.1;Data Source=C:\SomePath\NameOfYour.dbc;" );
// Open the connection, and if open successfully, you can try to query it yourConnectionHandler.Open();
if( yourConnectionHandler.State == ConnectionState.Open ) { OleDbDataAdapter DA = new OleDbDataAdapter(); string mySQL = "select A1.*, B1.* " + " from FirstTable A1 " + " join SecondTable B1 " + " on A1.SomeKey = B1.SomeKey " + " where A1.WhateverCondition "; // blah blah...
OleDbCommand MyQuery = new OleDbCommand( mySQL, yourConnectionHandle );
DA.SelectCommand = MyQuery;
DA.Fill( YourResultSet );
yourConnectionHandle.Close(); }
return YourResultSet; }}
s https://stackoverflow.com/a/10707417
On Thu, Jul 30, 2020 at 1:43 PM Matt Slay mattslay@jordanmachine.com wrote:
Now how do you get your data into an object in X# I do not know.
Indeed, still waiting on them to implement the SCATTER/GATHER commands.
It is listed as Github issue # 387 with a Jun 2020 Miletsone, but I think they missed that a little...
https://github.com/X-Sharp/XSharpPublic/issues/387
Robert has replied in the discussion forum with "It will be relatively easy to implement this with a UDC."
as can be seen in this message thread"
https://www.xsharp.info/forum/private-vfp/1278-scatter-dumping-a-data-row-to...
**
*Matt Slay* **
On 2020-07-30 1:17 PM, Stephen Russell wrote:
Scan is an iteration through data,right? I would just use foreach()
loop.
Now how do you get your data into an object in X# I do not know.
If you are filtering you should consider lamda expressions (x => x.ColumnName != 0).ToArray()
On Wed, Jul 29, 2020 at 11:01 AM MB Software Solutions, LLC < mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
No SCAN/ENDSCAN support yet?
On 7/29/2020 11:56 AM, Johan Nel wrote:
Hi all VFPers,
Well have not posted much lately about X# here due to some other issues I have to attend to, but good progress are made with support for the VFP dialect.
As per the message regarding .NET Core, I would also like to share progress with X# regarding .NET Core support.
Attached the link and posting by Robert today.
Hope it is of interest to (most) some.
Johan Nel George, South Africa.
https://www.xsharp.info/forum/public-product/2069-xsharp-builds-on-net-core
I would like to share some progress that I made today. I have changed the X# build system to support building for .Net Core. Consider an app that has one PRG file and a XSPROJ file. The contents of the XSProj file looks like this:
<Project Sdk="Microsoft.NET.Sdk"> <Import Project="$(XSharpMsBuildDir)\XSharp.NET.Sdk.props" /> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp5.0</TargetFramework> <ins>true</ins> <dialect>vo</dialect> </PropertyGroup> <ItemGroup> <Reference Include="XSharp.Core" /> <Reference Include="XSharp.RT" /> <Reference Include="XSharp.RDD" /> <Reference Include="XSharp.MacroCompiler" /> </ItemGroup> <Import Project="$(XSharpMsBuildDir)\XSharp.NET.Sdk.targets" /> <ItemGroup> <PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" /> </ItemGroup> </Project>
As you can see we are compiling for .Net Core 5.0 and for the VO dialect. I have included the XSharp assemblies needed to open a DBF file. The only "strange" thing in here is the package references to the System.Text.Encoding.CodePages package, because by default .Net Core does not have support for Codepage 1252 which I am using. Unlike traditional project files there are no items included. By default .Net Core includes all source code items in the folder.
The code looks like this:
USING System.Text
FUNCTION Start() AS VOID FIELD CUSTNUM, LASTNAME, FIRSTNAME Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) ? "Hello from X#" ? "OS :",OS(TRUE) ? "Framework:", System.Environment.Version:ToString() ? "Xsharp : version", Version(), "dialect", RuntimeState.Dialect:ToString() ? "Datetime :", DateTime() ? "Program :", ExecName(TRUE) ? "Workdir :", WorkDir() ? "Curdir :", System.IO.Directory.GetCurrentDirectory()
? "Opening, Indexing and listing a DBF with .Net Core" ? USE Customer INDEX ON LASTNAME TO LASTNAME DO WHILE ! EOF() ? Str(CUSTNUM,2) , LASTNAME, FIRSTNAME SKIP ENDDO ? "Press any key" Console.ReadLine() RETURN
As you can see I am calling a function in the Encoding class to link the package that has the codepage support. The rest is a normal mixture of Xbase code and .Net code. To compile and run the program I type
dotnet run
on the command line. The result is this:
Hello from X# OS : Windows 10 Enterprise (x64) ( Version 10.0, Build 18363 ) Framework: 5.0.0 Xsharp : version XSharp 2.5.2.0 dialect VO Datetime : 29-07-2020 16:10:58 Program : C:\test\bin\Debug\netcoreapp5.0\test.dll Workdir : C:\test\bin\Debug\netcoreapp5.0\ Curdir : C:\test Opening, Indexing and listing a DBF with .Net Core
6 Baker James 2 Borne Maria 15 Chandler Walter 3 Cooper Elizabeth 12 Cusumano Karen 5 Dougherty Janet . . 14 Walsh Gloria 19 Zimmerman Carla Press any key
As you can see the runtime, RDD system and Macro compiler all work on .Net Core 5.0 ! You can deploy this app with all support DLLs in one single Exe and 2 small DLLs by calling:
dotnet publish --self-contained true -r win-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true
This creates the following files, which make up the whole program:
29-07-2020 16:13 28.955.153 test.exe 28-05-2020 08:26 500.608 hostfxr.dll 28-05-2020 08:26 506.248 hostpolicy.dll
Even the XSharp DLLs are included in test,exe. The total size is 29 Mb.
You can also prepare an image for Linux by replacing win-x64 with linux-x64 and then the output is:
29-07-2020 16:16 44.552.454 test 28-05-2020 07:54 563.728 libhostfxr.so 28-05-2020 07:54 532.408 libhostpolicy.so
A self contained .Net app for Linux in 44 Mb !
I hope you find this interesting.
Robert
And yes this will be included in the next build. Not with the VS project system, that will take a bit longer.
[excessive quoting removed by server]