[Gambas-user] prb:Connection.Exec() bypass sql code

ron ronstk at ...239...
Sat Apr 29 20:37:49 CEST 2006


On Saturday 29 April 2006 20:22, Benoit Minisini wrote:
> On Saturday 29 April 2006 19:36, ron wrote:
> > function GetRecordCount(mytable) as integer
> >   dim Count as integer
> >   dim sql as string
> >   dim hResult as result
> >
> >   sql="select count(*) from " & mytable
> >   hresult = hConn.exec(sql)
> >   count = hResult.count
> >   hResult=null
> >   return Count
> > end
> >
-----8<------
> >
> 
> And what is the problem ?
> 

hConn.Exec("SELECT COUNT(*) FROM table") returns 1

Stupid Me :(

> mysql> select count(*) from makes;
> +----------+
> | count(*) |
> +----------+
> |        7 |

slap, slap and slap
I should use:  Count = hResult["COUNT(*)"]

Thanks,

Ron




More information about the User mailing list