Board index » delphi » SECOND POST - SQL Server 2000, stored procedures and master/detail

SECOND POST - SQL Server 2000, stored procedures and master/detail

Hi,

I'm in the process of building a D6 application using SQL Server 2000.

To start, I set up TADODataSets to read tables or views in the database,
linking some of them together in master/detail relationships.

I'm now in the process of switching the TADODataSets to stored procedures
and I'm finding that, although the properties of a TADODataSet continue to
display any master/detail relationship in the Object Inspector at
design-time, bringing up the Field Link Designer shows that the
relationships have gone. I can restore them and *apparently* save them, but
if I close and reopen the application, the m/d relationships are not there
again.

Is this a bug, or am I making a mistake?

Regards,

Stuart

 

Re:SECOND POST - SQL Server 2000, stored procedures and master/detail


Dear Stuart,

Try this (it works for me!):

Ds := TADODataSet.Create(Ds);
 with Ds do begin
    CommandType := cmdStoredProc;
    CommandText  := 'sp_AddCustomHeader';
    Connection := cdata.ADOConnection;      //cConnection.DbConnection;
    CommandTimeout := 30;
    parameters.Refresh;

    if Parameters.Count > 0 then
    begin
      FCustomerID := strtoint(Copy(strLine, 16, 6));           // CustomerID
      Parameters[1].Value := strtoint(Copy(strLine, 16, 6));
      Parameters[2].Value := TrimLeft(Copy(strLine, 22, 30));
      Parameters[3].Value := strtoint(Copy(strLine, 52, 2));
      //Parameters[4].Value := MakeDate(Copy(strLine, 54, 8));
      Parameters[4].Value := copy(strLine,58,4) + '-' + copy(strLine,56,2) +
'-' + copy(strLine,54,2);

      Parameters[5].Value := MakeDateTime(Copy(strLine, 62, 8),Copy(strLine,
70, 6));
      Parameters[6].Value := Copy(strLine, 76, 15);
      Parameters[7].Value := Copy(strLine, 91, 15);
      Parameters[8].Value := TrimLeft(Copy(strLine, 106, 275));
      try
        Parameters.Command.Execute();
        ReturnValue := 0;
      except
        ReturnValue := Parameters[0].Value;
        cData.ShowADOError('sp_ImportCustomHeader');
      end;
    end;
 end;
 CloseFile(flDKV);
 Ds.Free;

Have fun!

Richard van Dommelen

Other Threads