With the ADO components in Delphi 2007 through Delphi 11.2, I have the following problem:
My DBMS is Microsoft SQL Server. The "required" attribute is always false, even if the field is "NOT NULL". The issue happens with all 3 generations of ADO drivers tested with all 3 generations of Microsoft SQL Server (SQLOLEDB, SQLNCLI11, MSOLEDBSQL).
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOConnection1.ConnectionString := 'Provider=MSOLEDBSQL;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AKTEST_1;Data Source=SERVER1\XYZ,49010';
ADOConnection1.LoginPrompt := false;
ADOConnection1.Connected := true;
ADOTable1.Connection := ADOConnection1;
ADOTable1.TableName := 'TABLENAME';
ADOTable1.Active := true;
if ADOTable1.FieldByName('NOT_NULL_FIELDNAME').Required then showmessage('Field is not null') else showmessage('Field is null');
end;
Is there anything I can do, or is this a bug in Delphi?