| |

VerySource

 Forgot password?
 Register
Search
View: 1004|Reply: 6

Please help to see this code

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-25 11:00:02
| Show all posts |Read mode
0 begin
1 with DM.queXXX do
2 begin
3 Close;
4 SQL.Clear;
5 SQL.Add('insert into tabXXX');
6 SQL.Add('values ​​('+strtoint(Edit1.Text)+')');
7 ExecSQL;
8 end;
9 end;

       When compiling, it prompts an error on line 6. The error message roughly means that string and integer conflict. I'm a novice, I don't know how to solve it, please help from experts! Thank you! !
Reply

Use magic Report

0

Threads

40

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-9-25 22:45:01
| Show all posts
0 begin
1 with DM.queXXX do
2 begin
3 Close;
4 SQL.Clear;
5 SQL.Add('insert into tabXXX');
6 SQL.Add('values ​​('+Edit1.Text+')');
7 ExecSQL;
8 end;
9 end;
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-9-27 15:45:01
| Show all posts
with DM.queXXX do begin
  Close;
  SQL.Text :='INSERT INTO tabXXX VALUES(:V1)';
  Parameters.ParamByName('V1').Value := Edit1.text;
  ExecSQL;
end;
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-27 16:15:01
| Show all posts
Just insert it in the form of a character string`
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-27 16:30:01
| Show all posts
Just insert it in the form of a character string
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-27 16:45:01
| Show all posts
SQL.Add('values ​​('+Edit1.Text+')');
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-27 20:15:01
| Show all posts
Also remember to determine whether there is a value in Edit1.text. Safety first.
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