An error occurred while writing the query statement. An error occurred while displaying the data that could not be found. For more information, see Delphi/Windows SDK/API.
Http://www.delphi2007.net/DelphiBase/html/delphi_20061205203545276.html
If (form4.rbdepno. Checked) then
Begin
If trim (edit1.text) = ''then
Begin
Messagedlg ('the Department number cannot be blank! ', Mtwarning, [mbok], 0 );
Exit;
End
Else
Begin
S: = 'select * From depart where departid = '+ edit1.text;
If (S = '') then
Begin
Application. MessageBox ('the specified field in the database table has no records found! ', 'Records not found', mb_ OK );
End
Else
Query1. SQL. Add (s );
Query1.open;
End;
If (S = '') then
Begin
Application. MessageBox ('the specified field in the database table has no records found! ', 'Records not found', mb_ OK );
About this section Code If no matching field is found, the system prompts "no records are found for the specified field in the database table! ", Always running error. Can you see where the problem should be changed?
If (S = '') then
Begin
Application. MessageBox ('the specified field in the database table has no records found! ', 'Records not found', mb_ OK );
End
// The above judgment is superfluous, because s is definitely not ''---- You have assigned a value before!
It should be written after query1.open:
If query1.recordcount <1 then no records found!
Also, before query1. SQL. Add (), you should write at least:
Query1.close;
Query1. SQL. Clear;
The problem has been solved. Thank you ~
OK, you are so lucky! Congratulations! Close the post!
I didn't expect you to close the post so quickly! This is a good style! I like it!
Query1.close;
Query1. SQL. Clear; I wrote this before the query operation ~ Thank you ~
I don't know a lot about the new users, so I am asking you to help me more.