| |

VerySource

 Forgot password?
 Register
Search
View: 1033|Reply: 8

Very vegetable problem, please heroes help me

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-18 22:20:01
| Show all posts |Read mode
var
x: string;
sqlstr, y: integer;
begin
x: = '12313';
y: = 12;
sqlstr: = 'instert into cart values ​​(' '' + y + '' ',' '' + x + '' ')';
query1.connection: = main.conn;
...
end
The integer y in the SQL name cannot be inserted. How can I rewrite this SQL statement?
And how to read the field value in a query
I can read using query ['id'], but the query is limited to only one record
Help me! !!
Reply

Use magic Report

1

Threads

27

Posts

24.00

Credits

Newbie

Rank: 1

Credits
24.00

 China

Post time: 2020-1-25 12:36:02
| Show all posts
attention
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-25 20:36:01
| Show all posts
sqlstr: = 'insert into cart values ​​(' '' + IntToStr (y) + '' ',' '' + x + '' ')';
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-27 10:18:01
| Show all posts
var
x: string;
sqlstr, y: integer;
begin
x: = '12313';
y12;
sqlite: = 'insert into cart values ​​(' + y + ',' + '' '' + x + '' '' + ')';
query1.connection: = main.conn;
...
end
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-28 11:00:01
| Show all posts
My field is digital
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-29 16:27:01
| Show all posts
var
x: string;
sqlstr, y: integer; // sqlstr: String; sqlstr is a string! You wrote it wrong!
begin
x: = '12313';
y: = 12;
sqlstr: = 'instert into cart values ​​(' '' + y + '' ',' '' + x + '' ')';
// sqlstr: = 'insert into cart values ​​(' + inttostr (y) + ',' '' + x + '' ')';
// Y is an integer to turn around! There is no need to add 'in integers in SQL! So just remove it!
query1.connection: = main.conn;
...
end
Reply

Use magic Report

1

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-29 23:09:01
| Show all posts
var
x: string;
y: integer;
sqlstr: string;
begin
    x: = '12313';
    y: = 12;
    sqlstr: = 'insert into cart values ​​(' + inttostr (y) + ',' '' + x + '' ')';

query1.connection: = main.conn;
...
end
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-19 23:30:01
| Show all posts
You can use the format statement to format
Are you sure that the field you want to insert y is numeric?
sqlstr: = format ('instert into cart values ​​(% d,' '% s' ')', [y, x])
Reply

Use magic Report

0

Threads

40

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-5-22 10:30:01
| Show all posts
sqlstr: = 'insert into cart values ​​(' + IntToStr (y) + ',' + x + ')';
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