| |

VerySource

 Forgot password?
 Register
Search
View: 887|Reply: 4

There are obviously records in the table, why can't I find it?

[Copy link]

4

Threads

15

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-10-10 09:30:01
| Show all posts |Read mode
First look at the following code:
//Query in the table bed

  query3.Close;
  query3.SQL.Clear;
  query3.SQL.Add('select * from bed where bed_no = :para_bed_no');
  query3.ParamByName('para_bed_no').AsString := trim(DBedit13.Text);
  query3.Open; //Open the table, there is a record in the table
  if query3.RecordCount >= 1 then //This sentence turned out to be false, what's the matter?
  begin
    query3.Edit;
    query3.FieldByName('bed.s_no').AsString := trim(DBedit1.Text);
    query3.Post;
  end;

Regarding the above problem, I don't know what's going on. I use single-step operation as I said above! !
what the hell is it? I hope you can help me see what is going on?
Reply

Use magic Report

0

Threads

34

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-10-10 09:45:01
| Show all posts
Which is the Datasource-->Dataset of DBedit13? If it is Query3, then you have already closed, and DBedit13.Text is naturally empty
Reply

Use magic Report

0

Threads

34

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-10-10 10:00:01
| Show all posts
You can use a variable, before query3.Close; read out DBedit13.text, and then use it in Query3.sql
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-10-10 10:45:01
| Show all posts
if query3.RecordCount >= 1 then
//Try this?
if query3.isempty() then
Reply

Use magic Report

4

Threads

15

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-10-10 11:00:01
| Show all posts
Thank you! ! !
everyone! ! !
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list