Select...SQL SOLUCIONADO

Post Reply
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

Select...SQL SOLUCIONADO

Post 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.
Last edited by D.Fernandez on Sun Nov 29, 2020 4:31 pm, edited 1 time in total.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Select...SQL

Post 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
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

Re: Select...SQL

Post 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.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
D.Fernandez
Posts: 392
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay
Contact:

Re: Select...SQL SOLUCIONADO

Post 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.
Dario Fernandez
FWH, Harbour, BCC, MySql & MariaDB, tData, Dbf/Cdx
VSCode.
Maldonado - Uruguay
Post Reply