I'm using SQL Server 2017 and ADO components with Delphi, creating an FMX application for Windows.
In the DataModule, I've added a TADOConnection and some TADOTable and TADOQuery components. In the DataModule's OnCreate event, I have the following code:
ADOConnection.Connected := False;
AppINI := TIniFile.Create(ExtractFilePath(ParamStr(0))
+ 'AutoReg.INI');
try
fDatabase := AppINI.ReadString('DatabaseParms','Database','xxx');
ConnectStr := AppINI.ReadString('Initialization','Connection','');
finally
AppINI.Free;
end;
ADOConnection.DefaultDatabase := fDatabase;
if ConnectStr > '' then
ADOConnection.ConnectionString := ConnectStr;
try
ADOConnection.Connected := True;
for i := 0 to ComponentCount-1 do begin
if Components[i] is TADOTable then begin
TADOTable(Components[i]).Open;
end;
end;
except
on E: Exception do
ShowMessage(E.Message);
end;
In Delphi 11 (Alexandria), this works fine. But in Delphi 13 (Florence), I get an error when opening the TADOTable:
invalid variant operation
I've tracked this down to code in the UpdateIndexDefs function in the Data.Win.ADODB unit. The line:
LPos := IndexInfo.Fields[SOrdinalPosition].Value;
which returns an "unknown type 14" when checking the value of LPos.
I've tried switching from the SQLNCLI11 provider to the SQLOLEDB provider, but get the same error. I've also tried adding an IndexName and removing the value in the TADOTable properties, but no change there, either.
I'm not sure what else to try or change to resolve the problem. I'm happy to post more code if it would help, just let me know what else to add.
DECIMALvalues packed intoSQL_VARIANTtypes and, AFAIK, Delphi doesn't support unpacking those.