1
Good morning Personal
I would like a help half boring can be up to something kind of banal
I have a page on Asp connects.Asp as follows
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%
<%
dim conn
sub AbreConn()
'Criamos o objeto de conexão
Set conn = Server.CreateObject("ADODB.Connection")
'Abrimos uma conexão com o banco de dados
conn.Open("DRIVER={MySQL ODBC 5.1 Driver};SERVER=server;PORT=3306;DATABASE=database;USER=usuario;PASSWORD=senha;OPTION=3;")
conexao_executa=true
end sub
sub fechaConn()
'Fechamos a conexão com o banco de dados
conn.Close()
'Destruímos o objeto
Set conn = Nothing
end sub
'sub que executara comandos no bd
sub executaconexao(comando)
if conexao_executa=false then
call AbreConn
end if
response.Write(comando)
set objComando = Server.CreateObject("ADODB.Command")
objComando.ActiveConnection = conn
objComando.CommandText = comando
objComando.Execute()
Set objComando = Nothing
call fechaConn
end sub
%>
I can execute the select's
usually gives no error however at the time of doing an update or Insert it does not perform anything, and also no error whatsoever.
If anyone has any hint of what can be done thank you.
below as I call the update on the send page.
sql ="update produtos set descricao_produto = '" & server.HTMLEncode(request.form("elm1")) & "' where codigo_chave = 32"
executaconexao(sql)
How the query is printed on the screen?
– rray
If there is no error, it is obviously because everything is running smoothly. Check if there really is a record with
codigo_chave = 32
, because if there is, it will not fail. Test this update without the clausewhere
. So you will confirm that the records are indeed being updated.– Thiago Lunardi
Ah, and search for SQL Injection. :)
– Thiago Lunardi
@Thiagolunardi excuse the delay in the reply I think it refers to some permission in the bank because using on another server was done the normal update has some idea of what type of permission should have?
– Diego Ferreira de Oliveira
Well, then it is a question of mysql. See on documentation on Grant. It should, if that’s the cause.
– Thiago Lunardi