S
Sergei Shelukhin
Hi. I just started out with .NET, andt I have this question... I need to
display complicated set of data in the datagrid.
When I display it by getting appropriate query into the data adapter (query
is like "SELECT *,CAST(DATEPART(HH, r.dt1) AS char(2))+':'+CAST(DATEPART(mi,
r.dt1) AS char(2)) sdt1,CAST(DATEPART(HH, r.dt2) AS
char(2))+':'+CAST(DATEPART(mi, r.dt2) AS char(2))
sdt2,DATEDIFF(mi,r.dt1,r.dt2) tspan,(SELECT SUM(RA.Value*A.importance) FROM
RecordArea RA,Area A WHERE (RA.AreaId = A.AreaId) AND (RA.RecordId =
r.RecordId ) ) usef FROM record r LEFT OUTER JOIN Category ON (r.categoryid
= category.categoryid) WHERE dayid = (SELECT dayid FROM day WHERE rdate =
(SELECT MAX(rdate) FROM day WHERE status = 0) )" and growing), it is not
available for auto editing - cmponents' don't seem to recognise that it is
in fact Record table and some stuff around it
When I try to add InsertCommand & UpdateCommand to data adapter, it seems to
be ok, and it runs Update method without any errors but nothing is updated.
I also tried calling AcceptChanges for dataset and table itself before
adapter update, and it didn't help either.
I settled with updating manually with values taken out of databound
textboxes and such.
On the other hand i have learned that unlike for example BCB TQuery that is
plain, DataSet in .NET can include multiple tables, relations and other
things like that; if I had those, I could update everything automatically;
but then, how do I get this complicated thing into the DataGrid? Is there
any way to link things together and make DataAdapter "understand" what is
what?
And btw what is the right approach widely used for professional apps anyway?
I remember back in BCB original controls like TTable were not any effective
so I used manually constructed and launched queries for any more or less
complicated data operations, using TTable & TQuery bound to DBGrid (analogue
of DataGrid there) only for display...
display complicated set of data in the datagrid.
When I display it by getting appropriate query into the data adapter (query
is like "SELECT *,CAST(DATEPART(HH, r.dt1) AS char(2))+':'+CAST(DATEPART(mi,
r.dt1) AS char(2)) sdt1,CAST(DATEPART(HH, r.dt2) AS
char(2))+':'+CAST(DATEPART(mi, r.dt2) AS char(2))
sdt2,DATEDIFF(mi,r.dt1,r.dt2) tspan,(SELECT SUM(RA.Value*A.importance) FROM
RecordArea RA,Area A WHERE (RA.AreaId = A.AreaId) AND (RA.RecordId =
r.RecordId ) ) usef FROM record r LEFT OUTER JOIN Category ON (r.categoryid
= category.categoryid) WHERE dayid = (SELECT dayid FROM day WHERE rdate =
(SELECT MAX(rdate) FROM day WHERE status = 0) )" and growing), it is not
available for auto editing - cmponents' don't seem to recognise that it is
in fact Record table and some stuff around it
When I try to add InsertCommand & UpdateCommand to data adapter, it seems to
be ok, and it runs Update method without any errors but nothing is updated.
I also tried calling AcceptChanges for dataset and table itself before
adapter update, and it didn't help either.
I settled with updating manually with values taken out of databound
textboxes and such.
On the other hand i have learned that unlike for example BCB TQuery that is
plain, DataSet in .NET can include multiple tables, relations and other
things like that; if I had those, I could update everything automatically;
but then, how do I get this complicated thing into the DataGrid? Is there
any way to link things together and make DataAdapter "understand" what is
what?
And btw what is the right approach widely used for professional apps anyway?
I remember back in BCB original controls like TTable were not any effective
so I used manually constructed and launched queries for any more or less
complicated data operations, using TTable & TQuery bound to DBGrid (analogue
of DataGrid there) only for display...