Number of records retrieved from sql

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Number of records retrieved from sql

Post by AlessioForconi » Thu Feb 19, 2015 11:35 am

Hello everyone

having these instructions

Code: Select all

put "SELECT * from calcolo_ore" into tSQL
put revDataFromQuery(tab,return,dbID,tSQL) into tRecords
answer tRecords
recovery properly all the records, I try again with the answer tRecords.

How can I do, however, to know the number of records retrieved?
I saw that there revNumberOfRecords but I can not make it work.

Thank You

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Number of records retrieved from sql

Post by Klaus » Thu Feb 19, 2015 1:16 pm

Buongiorno Alessio,

like this:

Code: Select all

...
put "SELECT * from calcolo_ore" into tSQL
put revDataFromQuery(tab,return,dbID,tSQL) into tRecords
answer "Number of records:" && the num of lines of tRecords
...
:D

"revNumberOfRecords" will only work with a database Cursor after using "revQueryDataBase".


Best

Klaus

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Number of records retrieved from sql

Post by AlessioForconi » Thu Feb 19, 2015 4:43 pm

Klaus wrote:Buongiorno Alessio,

like this:

Code: Select all

...
put "SELECT * from calcolo_ore" into tSQL
put revDataFromQuery(tab,return,dbID,tSQL) into tRecords
answer "Number of records:" && the num of lines of tRecords
...
:D

"revNumberOfRecords" will only work with a database Cursor after using "revQueryDataBase".


Best

Klaus
thank you Klaus :)

The method that you indicated you work but I understand that they are on the wrong track.
Knowing the number of records recuperaati thought I could iterate through them to assign them to the data grid, but I chose the wrong method. :?

EDIT: I solved with this help 6591-converting-a-database-cursor-to-a-data-grid-array

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Number of records retrieved from sql

Post by Klaus » Thu Feb 19, 2015 5:42 pm

Hi Allessio,

if your datagrid is of type TABLE then you can simply:

Code: Select all

...
put "SELECT * from calcolo_ore" into tSQL
put revDataFromQuery(tab,return,dbID,tSQL) into tRecords
##answer "Number of records:" && the num of lines of tRecords
set the DGTEXT of grp "your datagrid here" to tRecords
## Done :-)
...
Best

Klaus

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Number of records retrieved from sql

Post by AlessioForconi » Fri Feb 20, 2015 6:08 pm

Hi Max

it's really that simple?

Thank you :D

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Number of records retrieved from sql

Post by Klaus » Fri Feb 20, 2015 6:12 pm

AlessioForconi wrote:Hi Max...
COME ON!

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Number of records retrieved from sql

Post by AlessioForconi » Fri Feb 20, 2015 6:29 pm

Klaus wrote:
AlessioForconi wrote:Hi Max...
COME ON!
Ooooppppssss :shock:

Hi Klaus :D

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Number of records retrieved from sql

Post by Klaus » Fri Feb 20, 2015 7:06 pm

AlessioForconi wrote:
Klaus wrote:
AlessioForconi wrote:Hi Max...
COME ON!
Ooooppppssss :shock:

Hi Klaus :D
:D

Post Reply