• 0
Sign in to follow this  
Thiago Torres

Delete From (me Ajudem)

Question

Olá galera,

bom já não entendo mais...rsrsrs

é o seguinte, eu tenho duas tabelas: import e destinatarios

na import eu tenho nome e email e na destinatarios também

eu to tentando rodar o código abaixo para que ele exclua da tabela DESTINATARIOS

os emails que estão na tabela IMPORT.

Mais aí está o problema...por exemplo:

na tabela DESTINATARIOS eu tenho 10 registros e cadastrei na tabela IMPORT 2 registros que existem

na tabela DESTINATARIOS, porém quando eu rodo o script ele não exclui, mas se eu tenho os mesmos

10 registros na IMPORT ele exclui tudo normal...o que será que está faltando que ele só exclui se

os registros forem os mesmos nas duas tabelas ???? me ajudem aeeeeeee

##########################################

<%

Set objConn= Server.CreateObject("ADODB.Connection")

objConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&ConexaoNewsletter&";"

Set objRS = Server.CreateObject("ADODB.RecordSet")

stringSQL = "select * from import order by nome"

objRS.open stringSQL,objConn,3,3

%>

<%

while not objRS.eof

objConn.Execute("DELETE FROM destinatarios WHERE nome = '" & objRS("nome") & "' and email ='" & objRS("email") & "';")

objRS.MoveNext

Wend

objConn.Execute("DELETE * FROM import")

response.redirect "grupos.asp"

%>

<%

objRS.close

objConn.close

Set objConn = Nothing

%>

##########################################################

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Aparentemento o cod esta ok, so estava faltando o * na string delete.

Set objConn= Server.CreateObject("ADODB.Connection")

objConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&ConexaoNewsletter&";"

Set objRS = Server.CreateObject("ADODB.RecordSet")

stringSQL = "select * from import order by nome"

objRS.open stringSQL,objConn,3,3

%>

<%

while not objRS.eof

objConn.Execute ("DELETE * FROM destinatarios WHERE nome = '" & objRS("nome") & "' and email ='" & objRS("email") &"'")

objRS.MoveNext

Wend

objConn.Execute("DELETE * FROM import")

response.redirect "grupos.asp"

%>

<%

objRS.close

objConn.close

Set objConn = Nothing

%>

Testa ai

falou

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
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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