Here are common errors, causes/solves in Delphi database applications:
DataSource property of the data aware control is not set or is set incorrectly (link is another DataSource)
Cause: Inadvertently changed during design, and not all of them were changed during copy and paste.
There is no data in the standard code during testing, so testing cannot be performed
Solution: Determine the order of the tables to which data need to be entered, enter the test data in turn, and then conduct the test
When performing data filtering in wwFilterDialog, the fields that should be displayed in the field list are not displayed, which is inconvenient to enter
Solution: judge the field and find the code to fill the field list
An error occurred when running the program with field not found
Cause: The database has changed, and the DataSet's field list is not updated
When using DBGrid to display data, for the convenience of reading, singular and odd rows are displayed in different colors. When browsing data, it is obvious that DBGrid data is not refreshed enough, and the colors of singular and odd rows cannot be displayed correctly.
Reason: There are many search fields in the DataSet of DBGrid's DataSource
Solution: Remove some search fields
The form title is English
Reason: No careful inspection after design
Solution: Change to Chinese
An error occurred after clicking the "Refresh" button in DBNavigator
The reason is unknown
Solution: Remove this button
DBNavigator used with dxDBGrid, when the mode of dxDBGrid is LoadAll, the navigation buttons are different from the expected way.
Reason: dxDBGrid is inconsistent with the data in DataSet when in LoadAll mode
Solution: Remove some buttons in the navigation
An error occurred in the DBNavigator corresponding to the data set obtained by the stored procedure.
Reason: Not clear
Solution: Remove this button
After the form show, after entering data editing, the data set is not opened when editing some search fields.
Cause: There is a problem with the dataset opening order
Solution: Adjust the opening order of the dataset and let the labeled dataset open first
An error occurred where stored procedure was not found
Reason: Renamed by stored procedures of database
Solution: Change the stored program name in DataSource
wwFilterDialog title blank
Solution: Change to a header related to the dataset, such as "Filter Plan"
When the form is designed under 1024*768, even if the form is 800*600, the content in the form cannot be displayed in full when the screen resolution is 800*600.
Solution: reserve a certain space when designing 800*600 under 1024*768
"Couldno't perform the edit because another user changed the record" error
Reason: Unknown
dxDBGrid cannot edit when dragging a field to the grouping bar: the current record in dxDBGrid is inconsistent with the current record of the data-aware control
Solution: Implement the two in different parts, not in the same form
"General SQL Error" error appears
Reason: Unknown. But I found that there are many tables opened in FormShow. When I tried to open some of the tables, the error disappeared, and the tables that were not opened at the same time, and the error disappeared.
(After the system sleeps) When connecting to the database for the first time (user and password are correct), an error occurs, but the second time is normal
Reason: Unknown
Open/Save dialog box without filtering conditions
Solution: Set up a reasonable Filter and DefaultExt
Error prevention measures are incomplete. (If the input data (digit) error occurs, no alarm will be called)
Solution: Verify the correctness judgment before saving, set Mask
Data aware control DBComboBox should be able to select and input the input box, but cannot be input.
Solution: Change the Style property to csDropDown
Other more general questions:
Modal dialog box, Escape key does not work
Solution: Reasonably set the Canceled property of Button
Modal dialog box, Enter key does not work by default
Solution: Set the Defaulted property of Button reasonably
The order of focus jumps after using the Tab key is irregular
Solution: Set the TabOrder property of the control