Why is TDBGrid not showing any data and columns editor doesn't offer to add all fields?

62 Views Asked by At

I used dbExpress in Data Explorer to create a new SQLite database. I added fields, when I first set it up it by dragging the connect then the table then setup theTDataSetProvider, TClientDataSet TDataSource and the TDBGrid and all worked but everything said (WideMemo) even though one of the fields was to be an Integer.

I needed to add another field so I used dbExpress to alter the database but when I went to save it I got a message that said not supported. I saved it again and it asked for new table name. Gave it a name (FWIW after this the Integer field in the new table is now reported as such and not a WideMemo, but the new field I added as Integer is a WideMemo).

I then went to the existing Table and changed the Command Text to the new table name, and tried to set the fields to what they should really be but it would complain that it's the wrong type and really nothing was working so I just deleted all those items and started fresh.

Drag over the connection, drag over the table, setup the TDataSetProvider, the TClientDataSet, TDataSource and add TDBGrid. Activated everything but nothing, the TDBGrid is empty, if I go to fields editor of the table item (TSQLDataSet), the fields show, on the TDBGrid if you go to the columns editor, the option to adds all fields is blank. Run the test app and still blank. Data Explorer view of the Table shows data in there.

I don't know what happened but I can't seem to get this test projects TDBGrid to work? I set it up using the information from Building a VCL Forms dbExpress Database Application

Any ideas what is not syncing here? Nothing weird in the .dfm.

Here's the .dfm (note that New2 was another attempt to alter db - both have the same data):

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 442
  ClientWidth = 628
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -12
  Font.Name = 'Segoe UI'
  Font.Style = []
  TextHeight = 15
  object ButtonStart: TButton
    Left = 216
    Top = 360
    Width = 75
    Height = 25
    Caption = 'Start Wizard'
    TabOrder = 0
    OnClick = ButtonStartClick
  end
  object ButtonCancel: TButton
    Left = 312
    Top = 360
    Width = 75
    Height = 25
    Cancel = True
    Caption = 'Cancel'
    ModalResult = 2
    TabOrder = 1
    OnClick = ButtonCancelClick
  end
  object DBGrid1: TDBGrid
    Left = 168
    Top = 32
    Width = 320
    Height = 289
    DataSource = DataSource1
    TabOrder = 2
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -12
    TitleFont.Name = 'Segoe UI'
    TitleFont.Style = []
  end
  object TestwizdbConnection: TSQLConnection
    ConnectionName = 'TestWizDB'
    DriverName = 'Sqlite'
    LoginPrompt = False
    Params.Strings = (
      'DriverName=Sqlite'
      'DriverUnit=Data.DbxSqlite'
      
        'DriverPackageLoader=TDBXSqliteDriverLoader,DBXSqliteDriver280.bp' +
        'l'
      
        'MetaDataPackageLoader=TDBXSqliteMetaDataCommandFactory,DbxSqlite' +
        'Driver280.bpl'
      'FailIfMissing=True'
      
        'Database=C:\Users\Delphi\Documents\Embarcadero\Studio\Projects\t' +
        'estwiz.db')
    Connected = True
    Left = 36
    Top = 28
  end
  object NewtableTable: TSQLDataSet
    CommandText = 'NewTable'
    CommandType = ctTable
    DbxCommandType = 'Dbx.Table'
    MaxBlobSize = 1
    Params = <>
    SQLConnection = TestwizdbConnection
    Left = 61
    Top = 110
    object NewtableTableName: TWideMemoField
      FieldName = 'Name'
      Required = True
      BlobType = ftWideMemo
      Size = 1
    end
    object NewtableTableRanking: TLargeintField
      FieldName = 'Ranking'
    end
    object NewtableTableNotes: TWideMemoField
      FieldName = 'Notes'
      BlobType = ftWideMemo
      Size = 1
    end
    object NewtableTabledatetime: TWideMemoField
      FieldName = 'datetime'
      BlobType = ftWideMemo
      Size = 1
    end
  end
  object DataSetProvider1: TDataSetProvider
    DataSet = New2Table
    Left = 40
    Top = 184
  end
  object ClientDataSet1: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'DataSetProvider1'
    Left = 48
    Top = 256
  end
  object DataSource1: TDataSource
    DataSet = ClientDataSet1
    OnDataChange = DataSource1DataChange
    Left = 48
    Top = 328
  end
  object New2Table: TSQLDataSet
    Active = True
    CommandText = 'New2'
    CommandType = ctTable
    DbxCommandType = 'Dbx.Table'
    MaxBlobSize = 1
    Params = <>
    SQLConnection = TestwizdbConnection
    Left = 124
    Top = 345
    object New2TableName: TWideMemoField
      FieldName = 'Name'
      Required = True
      BlobType = ftWideMemo
      Size = 1
    end
    object New2TableRanking: TWideMemoField
      FieldName = 'Ranking'
      BlobType = ftWideMemo
      Size = 1
    end
    object New2TableNotes: TWideMemoField
      FieldName = 'Notes'
      BlobType = ftWideMemo
      Size = 1
    end
    object New2Tabledatetime: TWideMemoField
      FieldName = 'datetime'
      BlobType = ftWideMemo
      Size = 1
    end
  end
end
0

There are 0 best solutions below