Jump to content
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • 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.