Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

AntSocial

Insert Into com erro

Recommended Posts

Bom dia,

 

Amigos, estou com um problema no seguinte código:

 

Set Conexao = Server.CreateObject("ADODB.Connection")	Conexao.Open "DBQ=C:\Inetpub\wwwroot\CAFENOVO\BD\agenda.mdb;Driver={Microsoft Access Driver (*.mdb)};"	ComandoSQL = "INSERT INTO eventos (evento, dc, categoria, data_entrada, data_venc, nome, valor, desc)"	ComandoSQL = ComandoSQL & " VALUES ("	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("evento")) & "',"	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("dc")) & "',"	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("categoria")) & "',"	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("data_entrada")) & "',"	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("data_venc")) & "',"	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("nome")) & "',"	ComandoSQL = ComandoSQL & "" & Server.HTMLEncode(Request.FORM("valor")) & ","	ComandoSQL = ComandoSQL & "'" & Server.HTMLEncode(Request.FORM("desc")) & "')"	Set bd = Conexao.Execute(ComandoSQL)	Conexao.Close	Set bd = Nothing	Set Conexao = Nothing

Tá dando erro na linha de execução... o que está errado?

 

Buenas!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Camarada,

 

Para facilitar poste o a msg de erro que esta retornando.

 

Agora que estava terminado notei q você possui uma coluna chamada desc e esta é uma palavra reservada da clausula ORDER BY. Então pode ser isto.

 

Fiz um teste:

DECLARE  @TMP TABLE (DESC CHAR(10))INSERT INTO @TMP (DESC) VALUES ('OIOI')SELECT * FROM @TMP
Retornou:
Server: Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'DESC'.Server: Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'DESC'.

QQ coisa estamo ai!

 

t+

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.