XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

[VFP]Two problems with CursorAdapter.SelectCmd in the XSharp.VFP namespace

Open vfp9 opened this issue 1 year ago • 4 comments

X# Version : 2.20.0.3

  1. You can't use ? in a Select statement. to pass parameters.For example:
CursorAdapter.SelectCmd = "Select ID, Name From Demo Where ID = ?VariableName "

"VariableName" is the name of a variable that has been defined and assigned a value or the name of a field in an opened table(It may be a table.field ). Build and run without errors. CursorFill() returns the False.

  1. You can't use double quote in a Select statement to pass parameters.For example:
CursorAdapter.SelectCmd = [Select ID, Name From Demo Where ID = "ID001" ]

Build and run without errors. CursorFill() returns the False. CursorFill() returns the True If you replace double quotes with single quotes.

The described above is allowed in VFP.

vfp9 avatar Sep 13 '24 06:09 vfp9

~~In addition, after I successfully CursorFill() in the Form1_Load method, it seems that the opened cursor is automatically closed after the WinForm is rendered. I'm not sure if it's my usage or a bug in the CursorAdapter.~~

vfp9 avatar Sep 13 '24 06:09 vfp9

For a separate SQL-Select command, SQLExec() also fails to execute in both of these cases.

vfp9 avatar Sep 13 '24 18:09 vfp9

Xinjie, Is "Variablename" the name of a local variable or of a public / private? What are the compiler options in the project?

RobertvanderHulst avatar Sep 16 '24 15:09 RobertvanderHulst

Robert

"Variablename",As I personally understand it, it can be any kind of variable.(According to VFP, it can be Public/Local/private,Any variable that is visible to the current Select statement will work.)

The following compiler options are stored in the xsproj file:

<Dialect>FoxPro</Dialect>
<Allowdot>True</Allowdot>
<NamedArgs>True</NamedArgs>
<OutputName>DisplayRelations</OutputName>
<StartupObject />
<AllowOldStyleAssignments>True</AllowOldStyleAssignments>
<LB>True</LB>
<Unsafe>False</Unsafe>
<InitLocals>True</InitLocals>
<MemVar>True</MemVar>
<Undeclared>True</Undeclared>
<Fox2>True</Fox2>
<Fox1>False</Fox1>
<AZ>False</AZ>

Note that the results of the program seem to be independent of compiler options.

vfp9 avatar Sep 16 '24 15:09 vfp9