Question about TDolphin/ oQry:Seek(SOLVED)

Question about TDolphin/ oQry:Seek(SOLVED)

Postby vilian » Thu Jun 25, 2015 1:52 pm

Hi Guys,

I'm Trying this Code:
Code: Select all  Expand view

FUNCTION Main()
   LOCAL oServer, oQry
   D_SetCaseSensitive( .T. )

   IF ( oServer := ConnectTo() ) == NIL
      RETURN
   ENDIF

   oQry = TDolphinQry():New( "SELECT * FROM usuarios ORDER BY usuario", oServer )
   If( oQry:Seek( "TESTE", "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE") )
   
   xBrowse(oQry)

RETURN nil
 


And allways display messenge "No found TESTE", but "TESTE" exist in table "usuários". See xBrowse image run after seek:
Image

What i are doing wrong ?
Last edited by vilian on Fri Jun 26, 2015 5:04 pm, edited 1 time in total.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Thu Jun 25, 2015 4:39 pm

Verifica que el ancho del campo sea igual al del valor a buscar, pudiese ser que al buscar "TESTE", lo limitas al ancho de 5 caracteres y si en la tabla tiene mas de 5, entonces no hay coincidencia, es una teoria vaga, ya que cuando uso SEEK lo hago con el valor de una variable del tamaño definida en el campo de la tabla, tambien intenta hacer un oQry:GOTOP(), antes de hacer la busqueda haber si es que el puntero se quedo al final de la tabla, aunque creo que SEEK hace un GOTOP antes de iniciar la busqueda, saludos... :shock:

prueba esto

Code: Select all  Expand view


local cbuscar // := space(ancho_del_campo)

oQry = TDolphinQry():New( "SELECT * FROM usuarios ORDER BY usuario", oServer )

oQry:Gotop()

cbuscar := oQry:usuario

   If( oQry:Seek( cBuscar, "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE") )

 
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby vilian » Thu Jun 25, 2015 5:04 pm

Thanks for try, but the problem continue. I changed the code for bellow:

Code: Select all  Expand view
FUNCTION Main()

   LOCAL oServer, oQry,cUsuario

   D_SetCaseSensitive( .T. )

   IF ( oServer := ConnectTo() ) == NIL
      RETURN nil
   ENDIF


   oQry = TDolphinQry():New( "SELECT * FROM usuarios ORDER BY usuario", oServer )
   oQry:GoTop()

   cUsuario := PadR("TESTE",6)
   If( oQry:Seek( cUsuario, "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE") )

   xBrowse( oQry )

RETURN nil


But oQry:Seek continue nof find the record. The problem is only with oQry:Seek, If i'm change this for oQry:Locate the program Works :(
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Thu Jun 25, 2015 5:21 pm

Aunque suene tonto, prueba asi haber, saludos... :shock:

IIf( oQry:Seek( cUsuario, "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE") )

o asi

If oQry:Seek( cUsuario, "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE")

o asi

If oQry:Seek( cUsuario, "usuario" ) > 0
MsgInfo("Found TESTE")
else
MsgInfo("No found TESTE")
endif
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby vilian » Thu Jun 25, 2015 5:33 pm

Thanks for help,

But oQry:Seek() allways Return ZERO. I don´t know whats happening ...
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Thu Jun 25, 2015 5:54 pm

Hare un programito pequeño como el tuyo con los mismos campos y datos..haber, coloca si puedes la structura de la tabla o mandamela a mi privado, como solucion rapida puedes hacerlo asi...saludos... :shock:

Code: Select all  Expand view

"SELECT * FROM usuarios WHERE usuario="+ campo + " ORDER BY usuario"

IF oQr:RecCount() > 0
? "existe"
ELSE
? "no existe"
ENDIF
 
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby vilian » Thu Jun 25, 2015 6:36 pm

Jose,

Bellow the SQL command to create this table:

Code: Select all  Expand view

DROP TABLE IF EXISTS `vfatec`.`usuarios`;
CREATE TABLE  `vfatec`.`usuarios` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario` varchar(6) DEFAULT NULL,
  `tpacesso` varchar(1) DEFAULT NULL,
  `ssl` tinyint(1) NOT NULL DEFAULT '0',
  `autentica` tinyint(1) NOT NULL DEFAULT '0',
  `portasmtp` double(4,0) DEFAULT '0',
  `portapop` double(4,0) DEFAULT '0',
  `pop` varchar(45) DEFAULT NULL,
  `provedor` varchar(2) DEFAULT NULL,
  `usremail` varchar(45) DEFAULT NULL,
  `micro` varchar(8) DEFAULT NULL,
  `ult_troca` date NOT NULL DEFAULT '0001-01-01',
  `ativo` tinyint(1) NOT NULL DEFAULT '0',
  `perfis` text,
  `menu` text,
  `data_inc` date NOT NULL DEFAULT '0001-01-01',
  `somnuprc` tinyint(1) NOT NULL DEFAULT '0',
  `ult_acesso` date NOT NULL DEFAULT '0001-01-01',
  `avisa` tinyint(1) NOT NULL DEFAULT '0',
  `email` varchar(50) DEFAULT NULL,
  `smtp` varchar(50) DEFAULT NULL,
  `senha` varchar(6) DEFAULT NULL,
  `pswemail` varchar(15) DEFAULT NULL,
  `tipo` varchar(1) DEFAULT NULL,
  `nome` varchar(50) DEFAULT NULL,
  `restricoes` text,
  `modulos` text,
  `modatv` text,
  `ultmnu` varchar(3) DEFAULT NULL,
  `hash` varchar(6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
 


Thanks for Support ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Thu Jun 25, 2015 7:19 pm

vilian wrote:Jose,

Bellow the SQL command to create this table:

Code: Select all  Expand view

DROP TABLE IF EXISTS `vfatec`.`usuarios`;
CREATE TABLE  `vfatec`.`usuarios` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `usuario` varchar(6) DEFAULT NULL,
  `tpacesso` varchar(1) DEFAULT NULL,
  `ssl` tinyint(1) NOT NULL DEFAULT '0',
  `autentica` tinyint(1) NOT NULL DEFAULT '0',
  `portasmtp` double(4,0) DEFAULT '0',
  `portapop` double(4,0) DEFAULT '0',
  `pop` varchar(45) DEFAULT NULL,
  `provedor` varchar(2) DEFAULT NULL,
  `usremail` varchar(45) DEFAULT NULL,
  `micro` varchar(8) DEFAULT NULL,
  `ult_troca` date NOT NULL DEFAULT '0001-01-01',
  `ativo` tinyint(1) NOT NULL DEFAULT '0',
  `perfis` text,
  `menu` text,
  `data_inc` date NOT NULL DEFAULT '0001-01-01',
  `somnuprc` tinyint(1) NOT NULL DEFAULT '0',
  `ult_acesso` date NOT NULL DEFAULT '0001-01-01',
  `avisa` tinyint(1) NOT NULL DEFAULT '0',
  `email` varchar(50) DEFAULT NULL,
  `smtp` varchar(50) DEFAULT NULL,
  `senha` varchar(6) DEFAULT NULL,
  `pswemail` varchar(15) DEFAULT NULL,
  `tipo` varchar(1) DEFAULT NULL,
  `nome` varchar(50) DEFAULT NULL,
  `restricoes` text,
  `modulos` text,
  `modatv` text,
  `ultmnu` varchar(3) DEFAULT NULL,
  `hash` varchar(6) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
 


Thanks for Support ;)


Why...name table...`vfatec`.`usuarios`..?, crei era 'usuarios' o tienes alguna otra tabla llamada usuarios..?
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Thu Jun 25, 2015 7:26 pm

Disculpa, ya entendi, 'vfatec' es la DATABASE...saludos... :shock:
Last edited by joseluisysturiz on Thu Jun 25, 2015 7:48 pm, edited 1 time in total.
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby vilian » Thu Jun 25, 2015 7:28 pm

Jose,

"vfatec' is the name of the schema in MySql. The tabel name is 'usuarios'
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Thu Jun 25, 2015 7:47 pm

Acabo probar tu codigo original del primer mensaje...y me funciono sin problemas, consiguio TESTE, saludos... :shock:

Code: Select all  Expand view

FUNCTION prueba()

   LOCAL oQry

   D_SetCaseSensitive( .T. )

   oQry = TDolphinQry():New( "SELECT * FROM usuarios ORDER BY usuario", oDatos:oConex ) // usando mi conexion...

   If( oQry:Seek( "TESTE", "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE") )
   
RETURN nil
 


asi que el problema seguro sera otra cosa....hasle un

? oQry:reccount()

haber si te cuenta los registros...
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby dutch » Thu Jun 25, 2015 9:52 pm

Dear Vilian,

I think, if it is not exact equal you should put lSoftSeek parameter.

Code: Select all  Expand view
oQry:Seek( cUsuario, "usuario" , , ,.T.)

vilian wrote:Thanks for try, but the problem continue. I changed the code for bellow:

Code: Select all  Expand view
FUNCTION Main()

   LOCAL oServer, oQry,cUsuario

   D_SetCaseSensitive( .T. )

   IF ( oServer := ConnectTo() ) == NIL
      RETURN nil
   ENDIF


   oQry = TDolphinQry():New( "SELECT * FROM usuarios ORDER BY usuario", oServer )
   oQry:GoTop()

   cUsuario := PadR("TESTE",6)
   If( oQry:Seek( cUsuario, "usuario" ) > 0, MsgInfo("Found TESTE"), MsgInfo("No found TESTE") )

   xBrowse( oQry )

RETURN nil


But oQry:Seek continue nof find the record. The problem is only with oQry:Seek, If i'm change this for oQry:Locate the program Works :(
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Question about TDolphin/ oQry:Seek

Postby vilian » Thu Jun 25, 2015 11:31 pm

Sorry my friends, i forgot say - I was using MariaDB.
And not yet have sucess to use oQry:Seek :(
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Question about TDolphin/ oQry:Seek

Postby joseluisysturiz » Fri Jun 26, 2015 12:24 am

vilian wrote:Sorry my friends, i forgot say - I was using MariaDB.
And not yet have sucess to use oQry:Seek :(


Ni modo man, esas cosas pasan, yo uso MySql, hasta los momentos y todo super bien...saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Question about TDolphin/ oQry:Seek

Postby Daniel Garcia-Gil » Fri Jun 26, 2015 12:26 pm

vilian wrote:Sorry my friends, i forgot say - I was using MariaDB.
And not yet have sucess to use oQry:Seek :(


i'll install mariadb to test any way you can contact with me by google hangout or gmail
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests