Problem when using calculated fields (in SQL script)

Problem when using calculated fields (in SQL script)

Postby swierzbicki » Fri 09 Dec 2005 11:27

Hi,

I have a problem when using Calculated fields inside a SQL Statement :

Select
Sum1,
Sum2,
(Sum1 + Sum2) As TotalSums
From
Table

Fields Sum1 and Sum2 exists.
Field TotalSums is a calculated field.

Link the corresponding myquery to a dataset.
Link the dataset to a grid....

1) open the dataset
2) edit the dataset
3) Change value from SUM1 field
4) Post the changes.

This will raise an exception, telling me that field TotalSums doesn't exists.

When opening (in design time) the MyQurey Editor, and looking at the SQL Generator, TotalSums field is present into the key and updatable fields (that shouldn't).

Is there a way to fix this without generating Insert / Update / Delete statements ?

Thank you
swierzbicki
 
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Postby Ikar » Fri 09 Dec 2005 13:01

Just add unique (autoincrement) field to select clause.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby swierzbicki » Fri 09 Dec 2005 16:00

Hello Ikar,

It was an exemple that I gave you. have an ssue with a table having an AutoInc fields....

This doesn't helps !
I
swierzbicki
 
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Postby swierzbicki » Fri 09 Dec 2005 16:06

Hello Ikar,

It was an exemple that I gave you. have an ssue with a table having an AutoInc fields....

This doesn't helps !
I
swierzbicki
 
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Postby GEswin » Sat 10 Dec 2005 12:13

Add the AutoInc field in the select statement.
GEswin
 
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain


Return to MySQL Data Access Components