Jump to content

teri

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by teri


  1. Hello -

     

    I wrote an application that uses a TFDQuery to retrieve data from a SQL Server. A few of the fields in the query are typed as TSQLTimeStampField. Everything works beautifully when I run the application, either from within the Delphi IDE or as a standalone app.

     

    However, when my colleague, who needs to use the application, tries to run it, she gets the following error.

     

     image.thumb.png.90f1b2f545ae34963410ee55a6f60c81.png

     

    We're using version 2019 of SQL Server, and the data field in the SQL table is typed as DateTime2(0).

     

    I tried changing CollectionTime's field type to WideString then DateTime, but each threw Debugger Exceptions.

     

    I'm at a loss as to how to remedy this. Any suggestions?

     

    Teri


  2. Thanks for the responses. I was actually clearing the dataset fdmColumnValues correctly, by clearing Fields and FieldDefs, but I had neglected to empty the fdmColumns dataset which I was using to define the field names. Thus, I was getting a duplicate field error. DOH!

     

    Teri

     


  3. Hello -

     

    I'm having same/similar issue when I try to reuse a TFDMemTable to load varying column count csv files.

     

    I read in the csv's header, construct the table fields then create the table. The second time it's run, I get a duplicate FieldDef error. 

     

    fdmColumns is a TFDMemTable containing the list of column headings. fdmColumnValues is the TFDMemTable I want to load the contents of the csv file into. What am I missing?

     

    Teri

     

      procedure DefineTable;
      begin
        fdmColumns.First;
        fdmColumnValues.Free;
        fdmColumnValues := TFDMemTable.Create(self);
        while not fdmColumns.eof do
        begin
          with fdmColumnValues.FieldDefs.AddFieldDef do
          begin
            Name := fdmColumns['ColumnName'];
            DataType := ftString;
          end;
          fdmColumns.Next;
        end;
        fdmColumnValues.CreateDataSet;
        dsColumnValues.DataSet := fdmColumnValues;
      end;

     

×