dbServer access in Bandol RC 2 & some other issues

This forum is meant for questions and discussions about the X# language and tools
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

dbServer access in Bandol RC 2 & some other issues

Post by ic2 »

I have installed Bandol RC 2 and compiled my 'Teletekstbrowser' without problems. This program does not use databases.

For a program that does, including ADS, I've removed all Vulcan & ADS references and included XSharp.Core.DLL, XSharp.RT.DLL, XSharp.RDD and XSharp.VO.DLL. To be complete, I repeat the instruction of Robert below, given in the New release comment area. Where I use dbServer I sometimes needed to use Vulcan.VO.DBServer. But just using dbServer, or XSharp.VO.DbServer or XSharp.RDD.DbServer or XSharp.Core.DbServer all fails, with an error like this:

Error XS0234 The type or namespace name 'DbServer' does not exist in the namespace 'XSharp.VO' (are you missing an assembly reference?)

1 How can I use dbServer in a statement like this:

Class IC2DbServer Inherit XSharp.Core.DbServer

Also I have this Vulcan reference, because just using "Array" gave problems in the past; it should be an array which works fully the same as in VO.

Protected aSysVars As Vulcan.__Array

2 How should I achieve that in RC 2?

Dick
[hr]

1) With Bandol RC2 you can completely replace the Vulcan Runtime with the X# runtime. 'Simply' replace the references to VulcanRT.DLL and VulcanRTFuncs.DLL with XSharp.Core.DLL, XSharp.RT.DLL and XSharp.VO.DLL. Also replace the references to VulcanVOGuiClasses.DLL, VulcanVOSystemClasses.DLL etc with the same named assemblies without the Vulcan prefixes.

2) Most likely you do not have to change anything. Only when you have referenced the Vulcan typenames with a fully qualified name (for example Vulcan.Error, Vulcan.VO.Window) or when you have added a using statement for Vulcan namespaces (USING Vulcan.VO) then you will have to change the namespaces.

3) The advantage RDD is included in our XSharp.RDD assembly. So you should remove the reference to Advantage.DLL and if your code uses RddSetDefault("AXDBFCDX") or something similar then it should work without changes. If you have used any of the special Ax..() functions then you need to add a reference to XSharp.RDD.DLL
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

dbServer access in Bandol RC 2 & some other issues

Post by Chris »

Hi Dick,

1. It's simply VO.DBServer in X#

2. Remove the vulcan part from the name. Simply "ARRAY" will work
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

dbServer access in Bandol RC 2 & some other issues

Post by ic2 »

Hello Chris,
1. It's simply VO.DBServer in X#
Unfortunately that doesn't work either:

Error XS0246 The type or namespace name 'VO' could not be found (are you missing a using directive or an assembly reference?)

Dick
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

dbServer access in Bandol RC 2 & some other issues

Post by Chris »

Then you did not add references to VORDDClasses.dll, VOGUIClasses.dll etc.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

dbServer access in Bandol RC 2 & some other issues

Post by ic2 »

Hello Chris,
Then you did not add references to VORDDClasses.dll, VOGUIClasses.dll etc.


I probably miss the point.
I used to have references to VulcanRT, VulcanRTFuncs, VulcanVOSystemClasses, VulcanVORDDClasses
and sometimes also:
VulcanVOGUIClasses,VulcanVOSystemClasses,VulcanVOWin32APILibrary

I understood the whole idea of Core X# was that I could drop these. Now I have to include VO DLL's again?

Apart from that, it does not solve the error. I included VOGUIClasses + VORDDClasses from C:Program Files (x86)XSharpRedist and still get the XS0246 error. Either with Class IC2DbServer Inherit DbServer and Class IC2DbServer Inherit VO.DbServer. Or VORDDClasses .DBServer which I also tried.

Dick
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

dbServer access in Bandol RC 2 & some other issues

Post by Chris »

Hi Dick,

The dlls XSharp.Core, XSharp.RT and XSharp.VO provide the basic runtime functionality for using the standard runtime functions like Left(), AAdd(), DBUseArea() etc etc.

If you need to use also classes that you were using in the VOSDK in VO, like DataWindow, DBServer etc, then you need to also use the respective dlls in XSharp as well (VOGUIClasses.dll, VORDDClasses.dll etc),e xactly the same way as you needed to do it in VO.

If you have added those references, the "VO.DBserver" should work fine. Please make sure that you have added a reference to the VORDDClasses (and VOSystemClasses) files, not to the vulcan ones that are prefixed with "Vulcan". If you have done that and it still doe not work, then please zip and send me the solution to have a look.

About Core, core as a dialect is meant to be a X# dialect very close to c#, but with X# syntax. It does not support USUALs, VO-style ARRAYs and things like that, but you can still DBFs with it. When you want to write VO-style code with VO data types from the runtime (USUALs etc) or from the VOSDK, then you need to use the VO dialect.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

dbServer access in Bandol RC 2 & some other issues

Post by Karl-Heinz »

Hi Dick,

1. To compile a app with a X# DBServer remove the Vulcan references and add references to these X#-Dlls - all taken from the ! GAC !

XSharp.Core
XSharp.RT
XSharp.VO
VORDDClasses
VOSystemClasses


2. If you´re using XIDE: In the Application -> Properties -> Compiler TabPage check the compiler option
[x] "ins/ Use Implicit Namespace"

or add the required VORDDClasses namespace:

USING VO

to your source files.

Now a "local oDB as DBserver" does no longer throw an compile error.

regards
Karl-Heinz
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

dbServer access in Bandol RC 2 & some other issues

Post by ic2 »

Hello Chris,

Starting with the error that seemed to remain: that was entirely my fault. I added the reference to the C# project instead of the X# project; both I use in the same solution....

You explanation is clear too; if I may summarize:
- Core X# has nothing to do with dropping Vulcan DLL's
- Dropping Vulcan DLL's is now possible thanks to the DBFCDX driver but then I need to include some VO DLL's

Correct?

I do have additional questions (Sorry...):

1 Does XSharp.RDD.DLL represent that new DBFCDX driver?
2 This does not work:
ulRetVal:=ACE.AdsConnect60( cConn ,ACE.ADS_REMOTE_SERVER, "adssys", Null, (Dword)ACE.ADS_DEFAULT, Self:hConn)

I removed, as Robert stated, "ACE" but X# is unaware of the EXPORT Static as dword parameters:
I know these:
ADS_REMOTE_SERVER = 2
ADS_LOCAL_SERVER = 1
ADS_AIS_SERVER = 4

also this one:

If ulRetVal=ACE.AE_SUCCESS (that is 0) or ADS_DEFAULT (also 0)

But there are a lot more values and most of these are not documented in ADS with their value. I'd say these should be recognizable in X#.

More problematic is that when I substituted all parameters with values (and removed ACE)
ulRetVal:=AdsConnect60( cConn ,2, "adssys", Null, 0, hConn)

I get:

Error XS0103 The name 'AdsConnect60' does not exist in the current context

Same goes for AdsDisconnect.

This works however:
AX_AXSLocking(lLocking)

But with the 2 above not working I won't be able to use ADS yet unless you've got another trick for me :)

Dick
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

dbServer access in Bandol RC 2 & some other issues

Post by Chris »

Hi Dick,

In short:

XSharp.Core, XSharp.RT, XSharp.VO: Provide basic functions (for strings, dbfs, arrays etc), standard VO language types like USUAL, DATE etc

XSharp.RDD: The base DBF, DBFNTX, DBFCDX etc functionality. Gets loaded automatically when you use any DBF related function

XSharp.MacroCompiler: Gets automatically loaded when you (or any of the code yu use) needs to use the macro compiler.

VORDDClasses: Provides the DBServer class and a couple others
VOGUIClasses; Provides the DataWindow, ShellWindow etc classes
similar for the other SDK libraries.


About the constants, you are right, the namespace of them is "XSharp.ADS", so in order to access the ACE.ADS_REMOTE_SERVER constant, you actually need to use

XSharp.ADS.ACE.ADS_REMOTE_SERVER

or put a

USING XSharp.ADS

in the beginning of your prg, so now you can use a simple

ACE.ADS_REMOTE_SERVER

About the Connect() and some other ADS functions, indeed those are not public, so not available to be used by user code. Not sure why, I will let Robert comment on that.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

dbServer access in Bandol RC 2 & some other issues

Post by robert »

Dick,
I will add the methods for AdsConnect60() asap.
Please add the following to your code to get it to work now:

[DllImport("ace32.dll", CharSet := CharSet.Ansi)];
FUNCTION AdsConnect60(pucServerPath AS STRING , usServerTypes AS WORD, ;
pucUserName AS STRING , pucPassword AS STRING , ulOptions AS DWORD, phConnect OUT IntPtr ) AS DWORD


And add
USING System.Runtime.InteropServices
to the beginning of your app.

All the code for the RDD system is on the web, as reference.

https://github.com/X-Sharp/XSharpPublic ... XSharp.Rdd

The ACE prototypes are in

https://github.com/X-Sharp/XSharpPublic ... rp.Rdd/ACE


Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply