| |

VerySource

 Forgot password?
 Register
Search
View: 2113|Reply: 10

I want to write a SELECT statement with operations displayed in DBGRID

[Copy link]

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-2 16:30:01
| Show all posts |Read mode
There is a value in the oracle data table. * 0.036 is the value I want.

select mynum * 0.036 as num1 from mydb;

Running in PL / SQL is no problem, the results can be displayed, but in DELPHI through ADOQUERY, want to display in DBGRID will not work. It seems that DELPHI took mynum * 0.036 as a field. What should I write to show the results?
Reply

Use magic Report

0

Threads

17

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-5-15 20:30:01
| Show all posts
Just set the FieldName of DBGrid
Reply

Use magic Report

0

Threads

14

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-5-16 12:15:02
| Show all posts
TField.DisplayFormat can customize its own display format,
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-5-17 02:15:01
| Show all posts
The field name of DBGrid has been set to num1

And it ’s not a problem with the display format. It ’s okay to display decimals. The problem is that it displays nothing at all.
Reply

Use magic Report

0

Threads

53

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-5-17 16:00:01
| Show all posts
Check if your data set connection is correct, whether your datasource is set, and field! Whether the datagrid is connected to the corresponding DataSource
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-5-17 23:45:01
| Show all posts
Oh, that ’s what I ’m saying, select mynum as num1 from mydb is running normally, and select mynum * 0.036 as num1 from mydb wo n’t work.
Reply

Use magic Report

0

Threads

40

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-5-19 15:45:01
| Show all posts
I want to use a static field or specify a data type in the DataSet. If mynum is an integer, mynum * 0.036 is an integer, and the data type has changed. Could it be the problem here?
Reply

Use magic Report

0

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-5-28 09:00:02
| Show all posts
How do I feel that you have n’t explained:
1. You want to enter a number, then multiply it by 0.036 to get one, and then display it. Use calculated fields.
2. You want to get a query directly, you can just query it directly, just set the precision!
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-6-4 14:30:01
| Show all posts
mynum is number type.
The data table records the speed of the vehicle, but the unit is cm/sec. I want to convert it to kilometers/hour and display it.
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-6-8 12:45:01
| Show all posts
Thank you all, the problem has been solved.
It should be a question of the type of field displayed.
Set the type of each field in the FIELDS EDITOR of ADOQUERY. Just make num1 a float type display.
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