Board index » cppbuilder » how does one access "non field" values (datepart)

how does one access "non field" values (datepart)


2005-03-29 04:06:17 AM
cppbuilder54
select datepart("dd",MyDate) from table where ....
works just fine useing the database explorer. For a particular month I
can retrieve (for example)
COLUMN1
-------
2
3
5
24
showing me there are 4 days from that month in the database for that
particular year in the query.
problem is I cannot seem to cleanly get those results back into my C++
code, inspecting MySqlQuery->showed me the fields, fieldnames and
values but i dont what those. I want the values that are listed under
"COLUMN1" ie: the 2,3,5 and 24 plus it would be nice to know there are
4 of them.
MySqlQuery->SQL = "select datepart(\"dd\",MyDate) from MyTable";
MySqlQuery->ExecSQL();
....????....
where can i extract the fact that there are 4 items whose values are
2,3,5 and 24?? If worse comes to worse, I assume one can fetch each
record and pull out the "day" field, but I would think that the sql
query object would have those values somewhere already. Maybe not???
..thanks in advance..
Joseph "Beemer Biker" Stateson
ResearchRiders.org
 
 

Re:how does one access "non field" values (datepart)

select datepart("dd",MyDate) from table where ....
works just fine useing the database explorer. For a particular month I can
retrieve (for example)
COLUMN1
-------
2
3
5
24
showing me there are 4 days from that month in the database for that
particular year in the query.
problem is I cannot seem to cleanly get those results back into my C++ code,
inspecting MySqlQuery->showed me the fields, fieldnames and values but i
dont what those. I want the values that are listed under "COLUMN1" ie: the
2,3,5 and 24 plus it would be nice to know there are 4 of them.
MySqlQuery->SQL = "select datepart(\"dd\",MyDate) from MyTable";
MySqlQuery->ExecSQL();
....????....
where can i extract the fact that there are 4 items whose values are 2,3,5
and 24?? If worse comes to worse, I assume one can fetch each record and
pull out the "day" field, but I would think that the sql query object would
have those values somewhere accessible already. Maybe not???
..thanks in advance..
Joseph "Beemer Biker" Stateson
ResearchRiders.org
 

Re:how does one access "non field" values (datepart)

Comments in line.
"Joseph Stateson" < XXXX@XXXXX.COM >wrote in message
Quote
select datepart("dd",MyDate) from table where ....

works just fine useing the database explorer. For a particular
month I can
retrieve (for example)

COLUMN1
-------
2
3
5
24

showing me there are 4 days from that month in the database for
that
particular year in the query.

problem is I cannot seem to cleanly get those results back into
my C++ code,
inspecting MySqlQuery->showed me the fields, fieldnames and
values but i
dont what those. I want the values that are listed under
"COLUMN1" ie: the
2,3,5 and 24 plus it would be nice to know there are 4 of them.

MySqlQuery->SQL = "select datepart(\"dd\",MyDate) from
MyTable";
Try naming the column so you can easily reference it. For
example "... MyDate) AS Column1 FROM MyTable".
Then read it in the normal way (FieldByName).
Quote
MySqlQuery->ExecSQL();
Don't you mean ->Open() here?
Quote
....????....


where can i extract the fact that there are 4 items whose
values are 2,3,5
and 24?? If worse comes to worse, I assume one can fetch each
record and
pull out the "day" field, but I would think that the sql query
object would
have those values somewhere accessible already. Maybe not???

..thanks in advance..

Joseph "Beemer Biker" Stateson
ResearchRiders.org

- Arnie
 

{smallsort}