Source language: Translate to:

Buscar en base de datos

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Buscar en base de datos

Postby neobookruletin » Thu Nov 27, 2014 9:17 am

Necesito atraves de un boton de ingreso de texto, que el texto introducido busque en la base de datos y que esta muestre solo los registros que encuentra. Se que es con qdpquerry, pero no logro hacerlo funcionar.

dbpQuery "datos" "Tabla1" "DESCRIPCION DEL PRODUCTO" error de sintaxix falta operador.
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby Gaev » Thu Nov 27, 2014 11:55 am

neobookruletin:

THROUGH need a button for entering text, the text entered search the database and this show only the records it finds. It is with qdpquerry , but I can not make it work.

dbpQuery "data" , " Table1 " " PRODUCT DESCRIPTION " sintaxix missing operator error .


The syntax for dbpQuery is ...
Code: Select all
dbpQuery "database id" "table" "filter"

"filter" should be something like ...
Code: Select all
"DescripcionDelProducto=[TextEntry1]"

... where ...

- DescripcionDelProducto is the name of the field you want to search

- [TextEntry1] is the variable containing text entered by your user
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Buscar en base de datos

Postby neobookruletin » Thu Nov 27, 2014 7:23 pm

Gaev gracias por responder,
la variable del botón de entrada de texto es [TextEntry1],
pongo la sintaxis como me dijiste y sigue poniendo error de sintaxis falta operador de consulta.
dbpQuery "data" , " Table1 " "DescripcionDelProducto=[TextEntry1]" sintaxix missing operator error

tengo una imagen para subir, pero no se como
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby neobookruletin » Thu Nov 27, 2014 7:34 pm

error: el parametro descripciondelproducto no tiene un valor predeterminado
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby stu » Fri Nov 28, 2014 3:28 am

Correct me if i'm wrong but, you're looking for a 'description' (varchar?) with operator =...

if its like that you should use LIKE instead and quote the expression.

So...

Syntax: [ Download ] [ Hide ]
Using Neobook Syntax Highlighting
dbpQuery "data" , " Table1 " "DescripcionDelProducto LIKE [#34][TextEntry1][#34]"
Parsed in 0.006 seconds, using GeSHi 1.0.8.10
Microsoft Access hater.
User avatar
stu
 
Posts: 318
Joined: Wed Aug 07, 2013 11:37 am

Re: Buscar en base de datos

Postby neobookruletin » Fri Nov 28, 2014 8:58 am

dbpOpenTable "datos" "Tabla1" ""
dbpQuery "datos" , " Tabla1 " "DescripcionDelProducto LIKE [#34][value][#34]"
me sale el siguiente error: la tabla tabla1 no esta abierta
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby Gaev » Fri Nov 28, 2014 10:14 am

neobookruletin:

dbpOpenTable "datos" "Tabla1" ""
dbpQuery "datos" , " Tabla1 " "DescripcionDelProducto LIKE [#34][value][#34]"
me sale el siguiente error: la tabla tabla1 no esta abierta

The last line says ...
I get the following error: tabla1 table is not open

... which most likely means that ...
Code: Select all
dbpOpenTable "datos" "Tabla1" ""

... did not get serviced properly ... due to some error.


Are you familiar with querying of Databases ? ...

1) If your database is of the type "MS Access", did you do a dbpOpenAccessDatabase command to open it ?

2) If so, did you ...

a) use "datos" as the "database id" in that command ?

b) does this database have a Table called "Tabla1" ?

3) in my previous post, DescripcionDelProducto was used only as an example ... is this the name of the field that you want to search ?

If you are not familiar with querying of databases, it is best to read the Help file first ... as it would not make sense to do a complete tutorial on it here on this forum.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Buscar en base de datos

Postby neobookruletin » Fri Nov 28, 2014 5:36 pm

Gracias Gaev por responder. Si mi base de datos es access
con dbfind funcions bien,
If "[value]" "=" ""
AlertBox "BUSQUEDA DE PRODUCTO" "DEBE INGRESAR EL PRODUCTO QUE DESEA BUSCAR"
Else
EndIf
dbpShowErrors "No"
dbpFind "datos" "Tabla1" "DESCRIPCION DEL PRODUCTO" "[value]" "ExactMatch=No;CaseSensitive=No"

pero necesito que me muestre en la tabla solo los resultados que encuentra, no que valla al registro como lo hace el dbfind, asi que debo usar qdpquery.

dbpOpenAccessDatabase "datos" "C:\ver\Database11.mdb" ""
dbpOpenTable "datos" "Tabla1" ""
dbpQuery "datos" , " Tabla1 " "DescripcionDelProducto LIKE [#34][value][#34]"
usando dbpquery me tira error: La tabla table1 no esta abierta.
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby stu » Sat Nov 29, 2014 4:45 am

Use a wildcard

LIKE [#34]S%[#34]

will show:

Salt
Something
Singer
Salmon
Sender
Slim

LIKE [#34]Sa%[#34]

will show:

Salt
Salmon

....
Microsoft Access hater.
User avatar
stu
 
Posts: 318
Joined: Wed Aug 07, 2013 11:37 am

Re: Buscar en base de datos

Postby Gaev » Sat Nov 29, 2014 7:23 am

neobookruletin:

usando dbpquery me tira error: La tabla table1 no esta abierta.
... in English ...
using dbpquery throws me error: The table1 not open
... most likely because in this statement ...
Code: Select all
dbpQuery "datos" , " Tabla1 " "DescripcionDelProducto LIKE [#34][value][#34]"
... you have spaces before and after the word Tabla1

Also, in your dbpFind you specified "DESCRIPCION DEL PRODUCTO" ... but in the dbpQuery command, you specified "DescripcionDelProducto" ... these are not the same ... note that ...

1) most Database Systems, Field Names ...

a) can not contain spaces
b) are case sensitive i.e. ADDRESS is not the same as Address

2) dbpFind accepts multiple field names ... although you have to separate them with semi-colons, the spaces might have caused the search to take place in a different field (or across all fields) ... which may be why you got some results with this command.

dbpQuery only works on one specified field.

What is the exact name of the field you want to search ?
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Buscar en base de datos

Postby neobookruletin » Sun Nov 30, 2014 6:06 am

Con dbpFind funciona, pero me lleva al campo que encuentra, y lo que quiero es que deje mostandro en el rectangulo solo los registros que se relacionan con la busqueda.
dbpFind "datos" "Tabla1" "DESCRIPCION DEL PRODUCTO" "[value]" "ExactMatch=No;CaseSensitive=No"

con dbpQuery uso ese comando:
dbpOpenAccessDatabase "datos" "C:\ver\Database11.mdb" ""
dbpOpenTable "datos" "Tabla1" ""
dbpQuery "datos" "Tabla1" "DESCRIPCION DEL PRODUCTO LIKE [#34][value][#34]"
dbpShowGrid "datos" "Tabla1" "Rectangulo1"

ERROR: error de sintaxix falta operador en la expresion de consulta "descripcion del producto like "alam" (alam es lo que escribi en el boton de ingresar texto. osea la variable [value].

Me gustaria poder enviar una imagen para que me puedas enterder mejor como tengo que hacer.
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby Gaev » Sun Nov 30, 2014 7:25 am

neobookruletin:

What is the exact name of the field you want to search ?

If it is "DESCRIPCION DEL PRODUCTO" ... change it to something like "DESCRIPCIONDELPRODUCTO" i.e. NO SPACES !!!

Then try again using ...
Code: Select all
dbpQuery "datos" "Tabla1" "DESCRIPCIONDELPRODUCTO LIKE [#34][value][#34]"


If your [value] can contain math symbols like +-/* , then place an exclamation mark ( ! ) before DESCRIPCIONDELPRODUCTO in the above statement/command
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Buscar en base de datos

Postby neobookruletin » Sun Nov 30, 2014 12:43 pm

GAEV GRACIAS POR AYUDARME

CAMBIE DESCRIPCION DEL PRODRUCTO A PRODUCTO OBIAMENTE EN LA TABLA ACCESS
QUEDO ASI
dbpQuery "datos" "Tabla1" "PRODUCTO LIKE [#34][value][#34]"
AHORA BUSCA PERO ME MUESTRA TODO EN BLANCO, NO APARECEN LOS REGISTROS, OSEA NO APARECE NADA
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby neobookruletin » Sun Nov 30, 2014 1:09 pm

FUNCIONA PERO DEBO ESCRIBIR EL REGISTRO TAL CUAL COMO ES. LA IDEA ES QUE BUSQUE POR CONCIDENCIAS EJEMPLO:
PINTURA LATEX PARA QUE LA BUSQUEDA APAREZCA SE DEBE ESCRIBIR IGUAL
Y SI ESCRIBO PINT NO APARECE NADA
neobookruletin
 
Posts: 31
Joined: Tue Nov 25, 2014 9:17 am

Re: Buscar en base de datos

Postby Gaev » Sun Nov 30, 2014 1:13 pm

neobookruletin:

Translation ...
FIND ME BUT NOW SHOWING ALL IN WHITE , NOT LISTED RECORDS, NOTHING APPEARS NO BONE

1) What was the value of [value] at the time ... if there are no exact matches, Grid will be empty

2) As stated by stu, try using ...
Code: Select all
dbpQuery "datos" "Tabla1" "!PRODUCTO LIKE [#34][value]%[#34]"

The % says you want to find records where PRODUCTO "starts with [value]"

Note that you should insert ! before PRODUCTO
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Next

Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 0 guests