I installed the previous X# and as a result immediately got some new errors. From one I don't understand why my fix didn't change it:
Error XS0121 The call is ambiguous between the following methods or properties: 'MySql.Data.MySqlClient.MySqlDataReader.GetString(string)' and 'System.Data.Common.DbDataReader.GetString(int)'
Code line is:
cValue:=Trim(oSQLrdr:GetString(AFields[ni]))
so I changed
Local oSQLrdr As MySqlDataReader
to
Local oSQLrdr As MySQL.Data.MySQLClient.MySqlDataReader
Why doesn't adding the namespace to the variable definition not solve this error?
Dick
XS0121 The call is ambiguous ...MySQL.Data
XS0121 The call is ambiguous ...MySQL.Data
Dick,
Most likeliy you are using a VO style array in aFields{}. The values in this array are of type USUAL.
At compile time the type of the contents of the USUAL is know known.
And there are runtime conversions available from USUAL to both Int and String.
So the compiler has no idea which of the two overloads you want to call.
If you know that the array contains strings you can add change the code to GetString( (String) aFields[ni] )
when you know that the array contains numbers then you can change the code to GetString ( (int) aFields[nI] ).
Robert
Most likeliy you are using a VO style array in aFields{}. The values in this array are of type USUAL.
At compile time the type of the contents of the USUAL is know known.
And there are runtime conversions available from USUAL to both Int and String.
So the compiler has no idea which of the two overloads you want to call.
If you know that the array contains strings you can add change the code to GetString( (String) aFields[ni] )
when you know that the array contains numbers then you can change the code to GetString ( (int) aFields[nI] ).
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
XS0121 The call is ambiguous ...MySQL.Data
Hello Robert,
Thanks for the reply, but when I change the line to:
cValue:=Trim(oSQLrdr:GetString(String)(AFields[ni]))
the error changes to:
Error XS0149 Method name expected
This is not explained in the help so I have no idea what to do next.
It used to work in earlier version. Can't I do something that it works without changing the code?
Although I understand that it's probably a good idea to tighten the compiler but it makes me very reluctant to update to a new version if I have to fix all kind of code lines which used to work fine before. I was using the July 2020 version until last week.
Dick
Thanks for the reply, but when I change the line to:
cValue:=Trim(oSQLrdr:GetString(String)(AFields[ni]))
the error changes to:
Error XS0149 Method name expected
This is not explained in the help so I have no idea what to do next.
It used to work in earlier version. Can't I do something that it works without changing the code?
Although I understand that it's probably a good idea to tighten the compiler but it makes me very reluctant to update to a new version if I have to fix all kind of code lines which used to work fine before. I was using the July 2020 version until last week.
Dick
XS0121 The call is ambiguous ...MySQL.Data
Dick,
The text (String) has to come between the open parenthesis from GetString and aFields:
Or you use a temp variable:
Robert
The text (String) has to come between the open parenthesis from GetString and aFields:
Code: Select all
cValue:=Trim(oSQLrdr:GetString((String)AFields[ni]))
Code: Select all
cValue := AFields[ni]
cValue := Trim(oSQLrdr:GetString(cValue))
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
XS0121 The call is ambiguous ...MySQL.Data
Hello Robert,
The 2 step second suggestion compiles fine now and is also a lot more readable; thanks.
Dick
The 2 step second suggestion compiles fine now and is also a lot more readable; thanks.
Dick