Jump to content

Erro código para base de dados MySQL


vhdl22
 Share

Recommended Posts

Tenho este código para guardar em base de dados MySQL. mas está me a dar erro no com.ExecuteNonQuery() :s

If ComboBox2.Text = "Avaliação Fisica" Then
           Dim com As MySqlCommand
           com = New MySqlCommand("INSERT INTO `avafisi` (`servico`,`nome`,`data`,`hora`,`preco`) VALUES ('" & ComboBox2.Text & "','" & ComboBox1.Text & "','" & DateTimePicker2.Text & "','" & ComboBox5.Text & "','" & TextBox1.Text & "',)", Conexao)
           Conexao.Open()
           com.ExecuteNonQuery()
           Conexao.Close()

           MessageBox.Show("Marcação efetuada com sucesso!")
       End If
Link to comment
Share on other sites

Tens uma vírgula a mais no fim do comando SQL.

Quando te deparares com problemas destes, e que queiras resolver na comunidade, procura sempre colocar o erro que te está a dar.

É mais fácil de perceber.

  • Vote 1

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

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
 Share

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