Jump to content

Problema ao executar query VB


vpess

Recommended Posts

Boas,

Ajudem-me por favor.

Porque é que ao fazer a query desta forma me dá erro:

ccombo2="nome"
busca="vitor"
ccombo1="nome"
ccombo3="asc"

SQL = "select * from socios where '" + CStr(ccombo2) + "' like '%" + CStr(busca) + "%' ORDER BY '" + CStr(ccombo1) + "' '" + CStr(ccombo3) + "'"

e desta não

SQL = "select * from socios where nome like '%vitor%' ORDER BY nome asc"
Link to comment
Share on other sites

Assim de repente parece ser das plicas que tens a mais na tua query no código vb. Tenta com:

SQL = "select * from socios where '" + CStr(ccombo2) + "' like '%" + CStr(busca) + "%' ORDER BY " + CStr(ccombo1) + " " + CStr(ccombo3)

Nick antigo: softclean | Tens um projeto? | Wiki P@P

Ajuda a comunidade! Se encontrares algo de errado, usa a opção "Denunciar" por baixo de cada post.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.