Jump to content
Fórum Script Brasil
  • 0

Importamdo Txt Pra Db


Guest Luis

Question

Fala ai galera tranquilo, estou tentando cadastrar info de um txt num db contudo ta dando o seguinte erro:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in query expression '_neemiaslima@uol.com.br'.

/email/index.asp, line 48

alguém ai poderia me ajudar?

Dim conex,db_path,path_do_arquivo,nome_do_arquivo

path_do_arquivo = "e:\home\interno\dados\"

nome_do_arquivo = "emails.txt"

cont = 0

db_path = "e:\home\interno\dados\email.mdb"

set conex = Server.CreateObject("ADODB.Connection")

conex.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & db_path

conex.open

'Use o objeto FileSystem para abrir o arquivo

Set fs = CreateObject("Scripting.FileSystemObject")

Set thisfile = fs.OpenTextFile(path_do_arquivo & nome_do_arquivo, 1, 0)

do while thisfile.AtEndOfStream=false

emaill = thisfile.Readline 

emaill = Trim(emaill)

strSQL = "SELECT * FROM tblMailingList order by Mail_ID"

Set bds = Conex.Execute(strSQL)

do while not bds.eof

emaildb = Trim(bds("email"))

if emaill = emaildb then

chave = "1"

end if

bds.movenext

loop

if chave = "1" then

response.write cont&" - "&emaill &" já estava cadastrado.<br>"

else

strUserCode = Left(emaill,2) & (9876989856 * CInt((RND * 32000) + 100))

SQLStmt = "INSERT INTO tblMailingList (Email,ID_Code)"

SQLStmt = SQLStmt & "VALUES (" & emaill

SQLStmt = SQLStmt & "," & strUserCode & ")"

set incluir = Conex.Execute(SQLStmt)

response.write cont&" - "&emaill & " Cadastrado com sucesso ! <br>"

cont = cont + 1

end if

chave = "0"

loop

conex.Close

set conex=nothing

set dbs=nothing

set incluir=nothing

thisfile.Close

set thisfile=nothing

set fs=nothing

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hum...

SQLStmt = "INSERT INTO tblMailingList (Email,ID_Code)"

SQLStmt = SQLStmt & "VALUES (" & emaill

SQLStmt = SQLStmt & "," & strUserCode & ")"

Acho que é assim:

<%
SQLStmt = "INSERT INTO tblMailingList (Email,ID_Code) VALUES ('"& emaill &"';'"& strUserCode &"');"

Vê ai...

Abraços!!!

Link to comment
Share on other sites

  • 0

continua dando erro

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in query expression ''_neemiaslima@uol.com.br';'_n223990375954368''.

/email/index.asp, line 47

Link to comment
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.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...