I am getting the following exception on SQL Server 2008 R2:
The same executable works just fine on SQL Server 2014.Project SVP.exe raised exception class EOLEDBError with message 'OLE DB error occurred. Code 80040E21h
Parameter[0] :number - the data value violates the schema's constraint for the column (Status = Bh).'.
The code is:
Code: Select all
  DataSet1 := CreateQuery('select distinct number as "nummer", behoerde, zusatz, strasse, ' + 'haus_nr, hsnr_zus, behoerde_plz, behoerde_ort, landkreis, land, art, einwohner, internet, wikipedia from behoerdenverzeichnis where (plz = :plz or :plz = '''') and (ort = :ort or :ort = '''')');
  DataSet1.ReadOnly := True;
  DataSource := TDataSource.Create(Self);
  DataSource.DataSet := DataSet1;
  DataSet2 := CreateQuery('select plz, ort from behoerdenverzeichnis where number = :number');
  DataSet2.MasterSource := DataSource;
  DataSet2.ReadOnly := True;
  DataSet2.Open;I found a workaround that works on both 2008 R2 and 2014, but I don't want to change the code in many places. The workaround looks like this:
Code: Select all
DataSet1 := CreateQuery('select distinct number as "nummer", behoerde, zusatz, strasse, ' + 'haus_nr, hsnr_zus, behoerde_plz, behoerde_ort, landkreis, land, art, einwohner, internet, wikipedia from behoerdenverzeichnis where (plz = :plz or :plz = '''') and (ort = :ort or :ort = '''')');
  DataSet1.ReadOnly := True;
  DataSource := TDataSource.Create(Self);
  DataSource.DataSet := DataSet1;
  DataSet2 := CreateQuery('select plz, ort from behoerdenverzeichnis');
  DataSet2.MasterSource := DataSource;
  DataSet2.MasterFields := 'number';
  DataSet2.DetailFields := 'number';
  DataSet2.ReadOnly := True;
  DataSet2.Open;