ERRO NO UPDATE DO MYSQL COM VB 6

BELETTI 25/10/2009 10:22:18
#326247
  If Len(Trim(txtnome1.RawText)) <> 0 Then sCampos = [Ô]cliente = [Ô] & ASPAS & txtnome1.Text & ASPAS
If Len(Trim(txtnome2.RawText)) <> 0 Then sCampos = sCampos & [Ô], nome2 = [Ô] & ASPAS & txtnome2.Text & ASPAS
[ô]If Len(Trim(Mid(txtclientes.Text, 3, 4))) = 0 Then sCampos = sCampos & [Ô], codigo = [Ô] & Mid(txtclientes.Text, 3, 4)
If Len(Trim(txtcep.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], cep = [Ô] & ASPAS & txtcep.Item(i).Text & ASPAS
If Len(Trim(txtrua.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], rua = [Ô] & ASPAS & txtrua.Item(i).Text & ASPAS
If Len(Trim(txtnumero.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], numero = [Ô] & txtnumero.Item(i).Text
If Len(Trim(txtbairro.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], bairro = [Ô] & ASPAS & txtbairro.Item(i).Text & ASPAS
If Len(Trim(txtcidade.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], cidade = [Ô] & ASPAS & txtcidade.Item(i).Text & ASPAS
If Len(Trim(cbouf.Item(0).Text)) <> 0 Then sCampos = sCampos & [Ô], uf = [Ô] & ASPAS & cbouf.Item(i).Text & ASPAS
If Len(Trim(txttelefone.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], telefone = [Ô] & ASPAS & txttelefone.Item(i).Text & ASPAS
If Len(Trim(txtfax.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], fax = [Ô] & ASPAS & txtfax.Item(i).Text & ASPAS
If Len(Trim(txtcelular.Item(0).RawText)) <> 0 Then sCampos = sCampos & [Ô], celular = [Ô] & ASPAS & txtcelular.Item(i).Text & ASPAS

If Len(Trim(txtcep.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], cep_c = [Ô] & ASPAS & txtcep.Item(i).Text & ASPAS
If Len(Trim(txtrua.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], rua_c = [Ô] & ASPAS & txtrua.Item(i).Text & ASPAS
If Len(Trim(txtnumero.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], numero_c = [Ô] & txtnumero.Item(i).Text
If Len(Trim(txtbairro.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], bairro_c = [Ô] & ASPAS & txtbairro.Item(i).Text & ASPAS
If Len(Trim(txtcidade.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], cidade_c = [Ô] & ASPAS & txtcidade.Item(i).Text & ASPAS
If Len(Trim(cbouf.Item(1).Text)) <> 0 Then sCampos = sCampos & [Ô], uf_c = [Ô] & ASPAS & cbouf.Item(i).Text & ASPAS
If Len(Trim(txttelefone.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], telefone_c = [Ô] & ASPAS & txttelefone.Item(i).Text & ASPAS
If Len(Trim(txtfax.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], fax_c = [Ô] & ASPAS & txtfax.Item(i).Text & ASPAS
If Len(Trim(txtcelular.Item(1).RawText)) <> 0 Then sCampos = sCampos & [Ô], celular_c = [Ô] & ASPAS & txtcelular.Item(i).Text & ASPAS

If Len(Trim(txtcep.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], cep_i = [Ô] & ASPAS & txtcep.Item(i).Text & ASPAS
If Len(Trim(txtrua.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], rua_i = [Ô] & ASPAS & txtrua.Item(i).Text & ASPAS
If Len(Trim(txtnumero.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], numero_i = [Ô] & txtnumero.Item(i).Text
If Len(Trim(txtbairro.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], bairro_i = [Ô] & ASPAS & txtbairro.Item(i).Text & ASPAS
If Len(Trim(txtcidade.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], cidade_i = [Ô] & ASPAS & txtcidade.Item(i).Text & ASPAS
If Len(Trim(cbouf.Item(2).Text)) <> 0 Then sCampos = sCampos & [Ô], uf_i = [Ô] & ASPAS & cbouf.Item(i).Text & ASPAS
If Len(Trim(txttelefone.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], telefone_i = [Ô] & ASPAS & txttelefone.Item(i).Text & ASPAS
If Len(Trim(txtfax.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], fax_i = [Ô] & ASPAS & txtfax.Item(i).Text & ASPAS
If Len(Trim(txtcelular.Item(2).RawText)) <> 0 Then sCampos = sCampos & [Ô], celular_i = [Ô] & ASPAS & txtcelular.Item(i).Text & ASPAS

If Len(Trim(txtcpf.RawText)) <> 0 Then sCampos = sCampos & [Ô], documento1 = [Ô] & ASPAS & txtcpf.Text & ASPAS
If Len(Trim(txtrg.RawText)) <> 0 Then sCampos = sCampos & [Ô], documento2 = [Ô] & ASPAS & txtrg.Text & ASPAS
If Len(Trim(txtemail.RawText)) <> 0 Then sCampos = sCampos & [Ô], email = [Ô] & ASPAS & txtemail.Text & ASPAS
If Len(Trim(txtusuario.RawText)) <> 0 Then sCampos = sCampos & [Ô], usuario = [Ô] & ASPAS & txtusuario.Text & ASPAS
If Len(Trim(txtsenha.RawText)) <> 0 Then sCampos = sCampos & [Ô], senha = [Ô] & ASPAS & txtsenha.Text & ASPAS
If Len(Trim(txtlimite.RawText)) <> 0 Then sCampos = sCampos & [Ô], limite = [Ô] & txtlimite.Text
If optfisica.Value Then sCampos = sCampos & [Ô], tipo = [Ô] & ASPAS & [Ô]F[Ô] & ASPAS Else sCampos = sCampos & [Ô], tipo = [Ô] & ASPAS & [Ô]J[Ô] & ASPAS
If optvenda.Value = 1 Then sCampos = sCampos & [Ô], venda = [Ô] & ASPAS & [Ô]0[Ô] & ASPAS Else sCampos = sCampos & [Ô], venda = [Ô] & ASPAS & [Ô]1[Ô] & ASPAS
If optativo.Value = 1 Then sCampos = sCampos & [Ô], status = [Ô] & ASPAS & [Ô]1[Ô] & ASPAS Else sCampos = sCampos & [Ô], status = [Ô] & ASPAS & [Ô]0[Ô] & ASPAS
If optcontrato.Value = 1 Then sCampos = sCampos & [Ô], contrato = [Ô] & ASPAS & [Ô]1[Ô] & ASPAS Else sCampos = sCampos & [Ô], contrato = [Ô] & ASPAS & [Ô]0[Ô] & ASPAS
If optficha.Value = 1 Then sCampos = sCampos & [Ô], ficha = [Ô] & [Ô]1[Ô] & ASPAS Else sCampos = sCampos & [Ô], ficha = [Ô] & ASPAS & [Ô]0[Ô] & ASPAS
If optmonitorado.Value Then sCampos = sCampos & [Ô], monitorado = [Ô] & ASPAS & [Ô]1[Ô] & ASPAS Else sCampos = sCampos & [Ô], monitorado = [Ô] & ASPAS & [Ô]0[Ô] & ASPAS
MontaSQL = [Ô]UPDATE [Ô] & Tabela & [Ô] SET [Ô] & [Ô] ([Ô] & sCampos & [Ô]) WHERE codigo = [Ô] & Mid(txtclientes.Text, 3, 4)


esse é meu codigo do update, e em anexo o erro que ta dando
Servidor online da hostnet
conexão ADO
MARCELO.TREZE 25/10/2009 14:38:31
#326249
apenas troque ASPAS por aspas simpes

([Ô] por [ô]), que ira funcionar


a query deve estar assim

UPDATE tabela SET campo = [ô]valor[ô] WHERE campo = [ô]valor[ô]


e não

UPDATE tabela SET campo = [Ô]valor[Ô] WHERE campo = [Ô]Valor[Ô]

EDERMIR 25/10/2009 17:46:17
#326254
Citação:

MARCELO-TREZE escreveu:
apenas troque ASPAS por aspas simpes

([Ô] por [ô]), que ira funcionar


a query deve estar assim

UPDATE tabela SET campo = [ô]valor[ô] WHERE campo = [ô]valor[ô]


e não

UPDATE tabela SET campo = [Ô]valor[Ô] WHERE campo = [Ô]Valor[Ô]


Quando os campos são CARACTER, devem estar entre ASPAS SIMPLES.
MARCELO.TREZE 25/10/2009 18:08:49
#326259
No caso do MYSQL todos devem ser tratados com aspas simples, inclusive data/hora
Tópico encerrado , respostas não são mais permitidas