Search the Community
Showing results for tags 'dbgrid'.
Found 3 results
I have a MSSQL table of financial transactions and I retrieve the data with a FDQuery which has the following statement: 'SELECT * FROM tAccounts ORDER BY AccName, TxnDate, Deposit' And executing that from the TFDQuery gives the correct results - a list in Account order and within that date order. See attached SQLView.jpg, specifically records 501 and 502 (correct date order). However, when I view this same table in a DBGrid in my application, the order is not the same. See attached DBGView.jpg, note the 20 Feb is before 17th Feb. The field is a Date datatype and there is no alteration to the Select statement anywhere in the application. The DBGrid is the first thing shown in the application and neither Formcreate or FormActivate do anything to alter the data returned. This 'mis-sorting' shows on several other of the records and my thinking is that in the DBGrid the TxnDate field is sorted in yyyy-mm-dd order, as in '20210217', which numerically comes before '20210220'. So this is what's happening, it seems, but why, when the SQL returns the data in the correct order does the DBGrid 're-sort' in a numeric fashion?
Hi I have two forms, each with a dbgrid showing items from different tables. On one grid when I select a row itrow highlights and the rows showing in the grid remain unchanged, as does the location of the row I selected. Using the up/down arrows moves the selected row up/down. On the other grid when I select a row it immediately re-positions that selected row to the middle of the visible rows. Using the up/down arrows the row selected remains exactly in the vertical centre. In the properties I can't see any differences between the two dbgrids, but would really like both dbgrids to behave the same way, whichever one of the above I don't mind. Any thoughts would help.
Hi I have two dbgrids, one with the Default Drawing property unchecked, the other with it checked. This latter is because I need to colour certain columns according to their values. On both I have AltRowShading checked with a slightly darker row colour, which works fine. When I select a row which has the alternate colour in the former dbgrid the color changes to a light blue on which the black text is clearly visible. However, on the latter when I select an alternate row the colour changes to a dark blue and the black text is not easily visible. I can't see anywhere a way to change this dark blue to be the same on both dbgrids, and the only difference in all the properties is the latter has default drawing checked. Any thoughts would help.