| |

VerySource

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

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

[Copy link]

1

Threads

5

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 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

Credits

Newbie

Rank: 1

Credits
16

 China

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

Use magic Report

0

Threads

13

Posts

8

Credits

Newbie

Rank: 1

Credits
8

 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

Credits

Newbie

Rank: 1

Credits
5

 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

48

Posts

26

Credits

Newbie

Rank: 1

Credits
26

 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

Credits

Newbie

Rank: 1

Credits
5

 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

33

Posts

23

Credits

Newbie

Rank: 1

Credits
23

 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

6

Posts

6

Credits

Newbie

Rank: 1

Credits
6

 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

Credits

Newbie

Rank: 1

Credits
5

 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

Credits

Newbie

Rank: 1

Credits
5

 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-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list