Select...SQL SOLUCIONADO

Select...SQL SOLUCIONADO

Postby D.Fernandez » Sat Nov 28, 2020 1:55 pm

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 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 464
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: Select...SQL

Postby Rick Lipkin » Sat Nov 28, 2020 4:48 pm

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  Expand view


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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Select...SQL

Postby D.Fernandez » Sat Nov 28, 2020 6:18 pm

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 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 464
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: Select...SQL SOLUCIONADO

Postby D.Fernandez » Sun Nov 29, 2020 4:31 pm

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 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 464
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 38 guests

cron