I have this code which reads text from a text file and posts it to the forum as a new topic. This code is called pop3retrieve.asp
page_to_read= "pop3temp\textfile.txt"
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(page_to_read))
read_text = act.readall
act.close
strMessage = "<pre>" & server.htmlencode(read_text) & "</pre>"
Response.Write strMessage
Response.Write "Posting to forum ..."
strSql = "INSERT INTO " & strTablePrefix & "TOPICS (FORUM_ID"
strSql = strSql & ", CAT_ID"
strSql = strSql & ", T_SUBJECT"
strSql = strSql & ", T_MESSAGE"
strSql = strSql & ", T_AUTHOR"
strSql = strSql & ", T_LAST_POST"
strSql = strSql & ", T_LAST_POST_AUTHOR"
strSql = strSql & ", T_LAST_POST_REPLY_ID"
strSql = strSql & ", T_DATE"
strSql = strSql & ", T_STATUS"
strSql = strSql & ", T_STICKY"
strSql = strSql & ", T_SIG"
strSql = strSql & ", T_ARCHIVE_FLAG"
strSql = strSql & ", T_REPLIES"
strSql = strSql & ", T_UREPLIES"
strSql = strSql & ", T_ISEVENT"
strSql = strSql & ", T_ALLOWREG"
strSql = strSql & ", T_MSGICON"
strSql = strSql & ") VALUES ("
strSql = strSql & 46
strSql = strSql & ", " & 21
strSql = strSql & ", '" & FixUpItems(Mailer.Subject) & "'"
strSql = strSql & ", '" & strMessage & "'"
strSql = strSql & ", " & 21
strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
strSql = strSql & ", " & 1
strSql = strSql & ", 0 "
strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
strSql = strSql & ", 1 "
strSql = strSql & ", 0 "
strSql = strSql & ", 0 "
strSql = strSql & ", 0 "
strSQL = strSQL & ", 0 "
strSQL = strSQL & ", 0 "
strSql = strSql & ", " & 0
strSql = strSql & ", " & 0
strSql = strSql & ", " & 2
strSql = strSql & ")"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
the textifle.txt contains text which looks like this:
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C355D6.2654CD80">
<link rel=Edit-Time-Data href="cid:editdata.mso@01C355D6.2654CD80">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
span.EmailStyle17
{mso-style-type:personal-compose;
mso-style-noshow:yes;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:Arial;
mso-ascii-font-family:Arial;
mso-hansi-font-family:Arial;
mso-bidi-font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Not sure what this will do but #8230;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><img width=311 height=400 id="_x0000_i1025"
src="cid:image001.jpg@01C355D6.2654CD80"><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><em><b><i><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial;font-weight:bold;mso-no-proof:yes'>Jeff </span></font></i></b></em><span
style='mso-no-proof:yes'><o:p></o:p></span></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial;mso-no-proof:yes'><a href="mailto:jeff@xxxx.xxxxxx.com"><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>jeff@nrxxxx.xxxxxx.com</span></font></a></span></font><span
style='mso-no-proof:yes'><o:p></o:p></span></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial;mso-no-proof:yes'><a href="http://xxxx.xxxxx.com/forum/"><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>http://xxxx.xxxxx.com/forum/</span></font></a></span></font><o:p></o:p></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>
This is the error I get:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 96: Incorrect syntax near 'tab'.
/pop3retrieve.asp, line 293
Line 293 being this line:
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Anyone help me understand how I would do this?