Ir para conteúdo

POWERED BY:

Arquivado

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

kauebranco

erro no ADODB.RECORDSET ....será que to

Recommended Posts

aee gente !!

 

to tentando fazer um envio de email em massa usando o objeto CDOSYS !!!!

 

na hora de abrir o banco passando o código SQL com "RS.OPEN sql" da erro

 

e o erro é assim

 

ADODB.Recordset error '800a0bb9'

 

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

 

/teste/MalaDireta.asp, line 68

 

o código da pagina está assim

 

ASP

[*]

 

[*]<% option explicit

 

[*]

 

[*]

 

[*]

 

[*]dim rs 

 

[*]dim cn 

 

[*]dim emailmsg

 

[*]dim emailcon

 

[*]dim SQL 

 

[*]dim PodeSair 

 

[*]dim Para

 

[*]dim sim

 

[*]

 

[*]if Request.Form("postBack"then 

 

[*]

 

[*]PodeSair false

 

[*]sim false

 

[*]

 

[*]

 

[*]if Request.Form("checkbox1"true or (Request.Form("checkbox2"true and Request.Form("checkbox3"true and Request.Form("checkbox4"truethen 

 

[*] SQL "SELECT email FROM tabela_MalaDireta"

 

[*] 

 

[*]elseif Request.Form("checkbox2"true and Request.Form("checkbox3"false and Request.Form("checkbox4"false then

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'a'"

 

[*] 

 

[*]else if Request.Form("checkbox3"true and Request.Form("checkbox2"false and Request.Form("checkbox4"false then

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'b'"

 

[*] 

 

[*]elseif Request.Form("checkbox4"true and Request.Form("checkbox2"false and Request.Form("checkbox3"false then 

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'c'"

 

[*] 

 

[*]elseif Request.Form("checkbox2"true and Request.Form("checkbox3"true and Request.Form("checkbox4"false then 

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'a' AND categoria = 'b'"

 

[*]

 

[*]elseif Request.Form("checkbox2"true and Request.Form("checkbox4"true then 

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'a' AND categoria = 'c'"

 

[*] 

 

[*]elseif Request.Form("checkbox3"true and Request.Form("checkbox4"true and Request.Form("checkbox2"false then 

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'c' AND categoria = 'b'"

 

[*] 

 

[*]end if 

 

[*]

 

[*]set RS server.CreateObject("ADODB.RECORDSET")

 

[*]set CN server.CreateObject("ADODB.CONNECTION")

 

[*]

 

[*]CN.ConnectionString "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../admin/database/Banco_MalaDireta.mdb") & ";Persist Security Info=False"

 

[*]

 

[*]cn.Open 

 

[*]

 

[*]Set emailmsg Server.CreateObject("CDO.Message")

 

[*]Set emailcon Server.CreateObject ("CDO.Configuration")

 

[*] 'Set and update fields properties

 

[*] With emailcon

 

[*] 'Out going SMTP server

 

[*] .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver""smtp2.locaweb.com.br"

 

[*] 'SMTP port

 

[*] .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

 

[*] 'CDO Port

 

[*] .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing"= 2

 

[*] 'Timeout

 

[*] .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"= 60

 

[*] .Fields.Update

 

[*] End With

 

[*]

 

[*] 'Update the CDOSYS Configuration

 

[*] Set emailmsg.Configuration = emailcon

 

[*]

 

[*] RS.Open SQL ''''[SIZE=7]O ERRO ESTÀ NESSA LINHA[/SIZE=7]

 

[*]

 

[*]  do 

 

[*]

 

[*]  Para RS.fields(0)

 

[*]

 

[*] With emailmsg

 

[*] 'Who the e-mail is from

 

[*] .From "revistati@revistati.com.br" 

 

[*]

 

[*] 'Who the e-mail is sent to

 

[*] .To = Para 

 

[*]

 

[*] 'The subject of the e-mail

 

[*] .Subject "Teste da Mala Direta"

 

[*]

 

[*]  .HTMLBody "Este email foi enviado para teste por kauebranco para teste de programação.Se você está lendo isso fique feliz pois esse mais novo sistema de mala direta está funcionando"

 

[*]

 

[*] .Send

 

[*]

 

[*] End with

 

[*]

 

[*]  RS.MoveNext 

 

[*]  if RS.EOF then 

 

[*]  PodeSair true

 

[*]  end if  

 

[*]  

 

[*]

 

[*]

 

[*]

 

[*]loop until PodeSair true 

 

[*]

 

[*]  cn.Close

 

[*]  'Close the server mail object

 

[*]  sim true

 

[*]

 

[*]end if 

 

[*]

 

[*]end if 

 

[*] if sim true then 

 

[*]  response.Redirect("DeuCerto.asp")

 

[*]  response.end

 

[*]  end if

 

[*]

 

[*]

 

[*]

 

[*]%>

 

[*]<HTML>

 

[*]<HEAD>

 

[*]

 

[*]<TITLE>Mala direta</TITLE>

 

[*]</HEAD>

 

[*]<BODY>

 

[*]

 

[*]<P>                                                          <STRONG> 

 

[*]Area de administração dos emails</STRONG> 

 

[*] </P>

 

[*]<P> </P>

 

[*]<P>               

 

[*]<U>MALA DIRETA</U> 

 

[*] </P>

 

[*]<P>   </P>

 

[*]<P>              

 

[*]<form action="MalaDireta.asp" method="post">categorias  <INPUT id=checkbox2 type=checkbox name=checkbox2>Cat 1</P>

 

[*]<P>                               <INPUT 

 

[*]id=checkbox3 type=checkbox name=checkbox3> Cat 2</P>

 

[*]<P>                            

 

[*]    <INPUT id=checkbox4 type=checkbox name=checkbox4>Cat 3 </P>

 

[*]<P>                                

 

[*]<INPUT id=checkbox1 type=checkbox name=checkbox1 checked>Todas</P>

 

[*]<P> </P>

 

[*]<P>                                                                 <input type="hidden" name="postBack" value="true">

 

[*]<INPUT id=submit1 style="WIDTH: 90px; HEIGHT: 24px" type=submit size=28 value=Enviar name=submit1></P>

 

[*]</form>

 

[*]</BODY>

 

[*]</HTML>

 

[*]

 

 

alguma ideia pessoal ???

Compartilhar este post


Link para o post
Compartilhar em outros sites

an vlww cara !! mais la está co o CDONTS e como dise to usando o CDOSYS !! e o erro num é nem sobre o e-mail por enkuanto !! queria saber pq deu erro nakela linha quando mando ele executar o codigo SQL !!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Verifica essa três linha:

ASP

[*]elseif Request.Form("checkbox2"true and Request.Form("checkbox3"true and Request.Form("checkbox4"false then 

 

[*]

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'a' AND categoria = 'b'"

 

[*]

 

[*]

 

[*]

 

[*]elseif Request.Form("checkbox2"true and Request.Form("checkbox4"true then 

 

[*]

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'a' AND categoria = 'c'"

 

[*]

 

[*] 

 

[*]

 

[*]elseif Request.Form("checkbox3"true and Request.Form("checkbox4"true and Request.Form("checkbox2"false then 

 

[*]

 

[*] SQL "SELECT email FROM tabela_MalaDireta WHERE categoria = 'c' AND categoria = 'b'"

É impossivel executar esses comandos sql, num seria OR no lugar de AND?

Compartilhar este post


Link para o post
Compartilhar em outros sites

pq é impossivel executar esses comandos ?? se eu quiser que pegue os que tenham "a" e "b" como que eu faço entaum ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

pior é que é verdade mesmo !! entendi o que você ta falando !! teria que ser assim WHERE categoria IN ('a','b') era isso né !! .. vlww

Compartilhar este post


Link para o post
Compartilhar em outros sites

mais só que tem um problema !! mesmo mudando isso tudo continua dando o mesmo erro e na mesma linha !! no RS.OPEN SQL, CN alguma outra coisa que eu fiz errado nesses SQL ....

Compartilhar este post


Link para o post
Compartilhar em outros sites

ii agora deu esse erro ...coloquei o que você dise no lugar dakela outra linha

Microsoft JET Database Engine error '80040e0c' Command text was not set for the command object. /teste/MalaDireta.asp, line 69

Compartilhar este post


Link para o post
Compartilhar em outros sites

como está seu SQL??o uso do IN é muito adequado em uma situação como essa sim...evita o uso demasiado de OR...

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.