[Gambas-user] Query Retrive single value ?
Benoit Minisini
gambas at ...2...
Thu May 8 19:29:34 CEST 2003
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
--
Benoit Minisini
mailto:gambas at ...1...
More information about the User
mailing list