Page 1 of 1

Select...SQL SOLUCIONADO

Posted: Sat Nov 28, 2020 1:55 pm
by D.Fernandez
Hi.
I can do a Updatesql and Delete, but no a Select.

cPass := "drslv"

csql := oCon:SELECT(" 'codigo' , 'pass' FROM 'usuario' WHERE 'codigo' = 'cpass' ")
ocon:Execute(csql)


MsgInfo(oCon[corto])
MsgInfo(oCon[pasar])

Thank you.

Re: Select...SQL

Posted: Sat Nov 28, 2020 4:48 pm
by Rick Lipkin
Dario

Several ways you can do this .. both use RecordSets .. Rao has created a set of ADO wrappers in \source\function\AdoFuncs.prg ..

or

Code: Select all


oRs := TOleAuto():New( "ADODB.Recordset" )
oRs:CursorType     := 1        // opendkeyset
oRs:CursorLocation := 3        // local cache
oRs:LockType       := 3        // lockoportunistic

cSQL := "SELECT  [codigo] , [pass] FROM [usuario] WHERE [codigo] = 'cpass' "

TRY
   oRs:Open(cSQL,oCon )
CATCH oErr
   MsgInfo( "Error in Opening Usuario table" )
   RETURN(.F.)
END TRY

xbrowse( oRs )

oRs:Close()

 
Rick Lipkin

Re: Select...SQL

Posted: Sat Nov 28, 2020 6:18 pm
by D.Fernandez
Rick, thans a lot, but I'm not use recorset.

Only tray to do a Select with WHERE to get the information of this "campos"


Thank you very much.

Re: Select...SQL SOLUCIONADO

Posted: Sun Nov 29, 2020 4:31 pm
by D.Fernandez
Gracias Marc.

Asi quedó.
FWCONNECT oCon HOST 'localhost' USER 'root' PASSWORD '' DB dbases

oRs := oCon:RowSet( "select * from usuario where `idusu` = &1", { cUsuario } )
? oRs:FieldGet(4)

Saludos.