[Gambas-user] Query Retrive single value ?

Dimitri Bellini dimitribellini at ...69...
Fri May 9 18:55:24 CEST 2003


On Thursday 08 May 2003 17:29, Benoit Minisini wrote:
> Le Jeudi 8 Mai 2003 19:44, Dimitri Bellini a écrit :
> > How can i select only one record from SQL call like this:
> > - Select ID from Book where Title = "Pinocchio"
> > and put into a TextBox or variable?
> > Thanks in advance
> > Dimitri
>
> Let's suppose you have an opened connection on a database named hConn.
>
> DIM hConn AS Connection
> DIM sId AS STRING
> DIM hResult AS Result
>
> sId = "Pinocchio"
>
> hResult = hConn.Find("Book", "Title = &1", sId)
> ' Or you can do:
> ' hResult = hConn.Exec("Select ID from Book where Title = &1", sId)
>
> IF hResult.Available THEN
>   MyTextBox.Text = hResult!ID
> ENDIF

Thanks work fine!!!
Dimitri




More information about the User mailing list