Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

Sign in to follow this  
kazzx

[RESOLVIDO] SELECT para Access2007 - VB.NET

Recommended Posts

kazzx

estou com algumas dificuldades em fazer um select, pessoal.

tenho isto:

 conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
           Application.StartupPath & "\BD Ponto JA.accdb"
        Dim cmd As OleDbCommand = conn.CreateCommand
        cmd.CommandText = "select Nome Completo from [inscrição Utente] where [Nome Completo] like '" & txtverifica.Text & "%'"
        'cmd.CommandText = "Select nome FROM Utilizadores Where [nome] Like  '" & txtverifica.Text & "%'"
        Dim cmdo As OleDbCommand = conn.CreateCommand
        cmdo.CommandText = "select Localidade from [inscrição Utente] where [Nome Completo] like '" & txtverifica.Text & "%'"
        'cmdo.CommandText = "Select Localidade from Utilizadores Where [Nome] Like '" & txtverifica.Text & "%'"
        Dim cmde As OleDbCommand = conn.CreateCommand
        cmde.CommandText = "select Morada from [inscrição Utente] where [Nome Completo] like '" & txtverifica.Text & "%'"
        'cmde.CommandText = "Select Morada from Utilizadores Where [Nome] Like '" & txtverifica.Text & "%'"

        'Abre conexão ..
        conn.Open() 

e o programa diz-me que falta um operador, ou seja, algo no SQL está mal :x

ajudas ?

Share this post


Link to post
Share on other sites
kazzx

que cego, faltava-me os [ ] nos campos a seleccionar.

do género ..

 cmd.CommandText = "select [Nome Completo] from [inscrição Utente] where [Nome Completo] like '" & txtverifica.Text & "%'" 

Share this post


Link to post
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
Sign in to follow this  

×

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.