Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forum Error - NO REASON! Help!!!! 1

Status
Not open for further replies.

Ladyborg

Programmer
May 11, 2002
208
US
I'm using DUForum Pro on a web site. One forum is working fine with the same exact code as you see below, only the connection string changed as it is a different database. I get an error on line 56 which is the last line of code below [cmdPost.Execute()] - the error I get is at the end of this posting.

<!--#include file=&quot;../includes/inc_config.asp&quot; -->
<!--#include file=&quot;../../../Connections/cnpublic.asp&quot; -->
<% If Request.Form(&quot;SUBMIT&quot;) = &quot;POST&quot; then 'submit = post ----> codes for posting a new message %>
<%

if(Request.Form(&quot;FOR_ID&quot;) <> &quot;&quot;) then cmdPost__for_id = Request.Form(&quot;FOR_ID&quot;)

if(Request.Form(&quot;MSG_INFORMED&quot;) <> &quot;&quot;) then cmdPost__msg_informed = Request.Form(&quot;MSG_INFORMED&quot;)

if(Request.Cookies(&quot;CookieUser&quot;) <> &quot;&quot;) then cmdPost__msg_author = Request.Cookies(&quot;CookieUser&quot;)

if(Request.Form(&quot;MSG_SUBJECT&quot;) <> &quot;&quot;) then cmdPost__msg_subject = Request.Form(&quot;MSG_SUBJECT&quot;)

if(Request.Form(&quot;MSG_BODY&quot;) <> &quot;&quot;) then cmdPost__msg_body = Request.Form(&quot;MSG_BODY&quot;)

%>
<%
Dim rsMailed__MMColParam
rsMailed__MMColParam = &quot;True&quot;
if (Request(&quot;MM_EmptyValue&quot;) <> &quot;&quot;) then rsMailed__MMColParam = Request(&quot;MM_EmptyValue&quot;)
%>
<%
set rsMailed = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsMailed.ActiveConnection = MM_cnpublic_STRING
rsMailed.Source = &quot;SELECT U_EMAIL, U_FIRST FROM USERS, PROFILES WHERE U_NAME = U_ID AND U_MAILED = &quot; + Replace(rsMailed__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;&quot;
rsMailed.CursorType = 0
rsMailed.CursorLocation = 2
rsMailed.LockType = 3
rsMailed.Open()
rsMailed_numRows = 0
%>
<%
Do While NOT rsMailed.EOF
Dim objCDO
Set objCDO = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
objCDO.From = Request.Form(&quot;FOR_NAME&quot;) & &quot;Forum@&quot; & myDomain
objCDO.To = rsMailed.Fields.Item(&quot;U_EMAIL&quot;).Value
objCDO.Subject = &quot;New message posted&quot;
objCDO.Body = &quot;Hello &quot; & rsMailed.Fields.Item(&quot;U_FIRST&quot;).Value & &quot;! A new message has been posted in the &quot; & Request.Form(&quot;FOR_NAME&quot;) & &quot; forum. Please click below to go read it: &quot; & vbnewline & myURL & &quot;/forums/messages.asp?r=forums&t=&quot; & Request.Form(&quot;FOR_NAME&quot;) & &quot;&i=&quot; & Request.Form(&quot;FOR_ID&quot;)
objCDO.Send()
Set objCDO = Nothing
rsMailed.MoveNext
loop
%>
<%
rsMailed.Close()
%>
<% 'codes to insert a new topic into MESSAGES table
set cmdPost = Server.CreateObject(&quot;ADODB.Command&quot;)
cmdPost.ActiveConnection = MM_cnpublic_STRING
cmdPost.CommandText = &quot;INSERT INTO MESSAGES (&quot; + Replace(cmdPost__for_id, &quot;'&quot;, &quot;''&quot;) + &quot;, &quot; + Replace(cmdPost__msg_informed, &quot;'&quot;, &quot;''&quot;) + &quot;, &quot; + Replace(cmdPost__msg_author, &quot;'&quot;, &quot;''&quot;) + &quot;, &quot; + Replace(cmdPost__msg_subject, &quot;'&quot;, &quot;''&quot;) + &quot;, &quot; + Replace(cmdPost__msg_body, &quot;'&quot;, &quot;''&quot;) + &quot;) VALUES (&quot; + Replace(cmdPost__for_id, &quot;'&quot;, &quot;''&quot;) + &quot;, &quot; + Replace(cmdPost__msg_informed, &quot;'&quot;, &quot;''&quot;) + &quot;, '&quot; + Replace(cmdPost__msg_author, &quot;'&quot;, &quot;''&quot;) + &quot;', '&quot; + Replace(cmdPost__msg_subject, &quot;'&quot;, &quot;''&quot;) + &quot;', '&quot; + Replace(cmdPost__msg_body, &quot;'&quot;, &quot;''&quot;) + &quot;') &quot;
cmdPost.CommandType = 1
cmdPost.CommandTimeout = 0
cmdPost.Prepared = true
cmdPost.Execute()
%>



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

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.


CAN ANYONE SHED LIGHT ON THIS?!?!!!!!
I'VE RACKED MY BRAIN ON IT!%-) [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
This is what happens when you handwrite code while learning to play Ghost Recon.

take this


<% Dim rs
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open MM_cnpublic_STRING


SQLstmt = &quot;Insert into Messages(FOR_ID,MSG_DATED,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED,MSG_TIME,MSG_EMAIL)&quot;
SQLstmt = SQLstmt & &quot;VALUES(&quot; & cmdPost__for_id
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_author,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_subject, &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_body, &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & cmdPost__msg_informed & &quot;'&quot;
SQLstmt = SQLstmt & &quot;)&quot;
'response.Write SQLstmt
Set RS = Conn.Execute(SQLstmt)
set rs=nothing
Conn.Close
set conn=nothing
%>


and replace with this


<% Dim rs
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open MM_cnpublic_STRING


SQLstmt = &quot;Insert into Messages(FOR_ID,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED)&quot;
SQLstmt = SQLstmt & &quot;VALUES(&quot; & cmdPost__for_id
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_author,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_subject, &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_body, &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & cmdPost__msg_informed & &quot;'&quot;
SQLstmt = SQLstmt & &quot;)&quot;
'response.Write SQLstmt
Set RS = Conn.Execute(SQLstmt)
set rs=nothing
Conn.Close
set conn=nothing
%>
&quot;Never underestimate the power of determination&quot;

Stuart
 
Error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/publicforum/forums/msgAdding.asp, line 62


Line 62:
Set RS = Conn.Execute(SQLstmt) [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
ok see the

'response.Write SQLstmt

remove the ' infront of it - run it again and copy what it spits out. &quot;Never underestimate the power of determination&quot;

Stuart
 
Error:

Insert into Messages(FOR_ID,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED)VALUES(7,'test1','test 3/10 15:22','test','YES')
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/publicforum/forums/msgAdding.asp, line 62
[gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
There shouldnt be a date in that - unless you keyed it in manually.

The subject field - did you just type test, or did you do test 3/10 15:22

? &quot;Never underestimate the power of determination&quot;

Stuart
 
subject field: test 3/10 15:22
message: test [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
even typed in that should work

try just putting


test subject


into the subject line and see if it gives the same error &quot;Never underestimate the power of determination&quot;

Stuart
 
Error:

Insert into Messages(FOR_ID,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED)VALUES(7,'test1','test 3/10 15:53','testing message on public forum','YES')
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/publicforum/forums/msgAdding.asp, line 62
[gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
Ok, so somehow a date / time field is being entered as subject line or added to it.

hmmmmm

on the form page, look at the fields, how many show

MSG_Subject

? &quot;Never underestimate the power of determination&quot;

Stuart
 
Only one. Here's the form:

<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<% If Request.Cookies(&quot;CookieUser&quot;) <> &quot;&quot; Then %>
<tr>
<td align=&quot;left&quot; valign=&quot;top&quot; bgcolor=&quot;#000000&quot;><img src=&quot;../assets/spacer.gif&quot; width=&quot;1&quot; height=&quot;1&quot;></td>
</tr>
<tr>
<td align=&quot;left&quot; valign=&quot;top&quot; bgcolor=&quot;#000000&quot;><img src=&quot;../assets/spacer.gif&quot; width=&quot;1&quot; height=&quot;1&quot;></td>
</tr>
<tr>
<td align=&quot;left&quot; valign=&quot;top&quot; bgcolor=&quot;#FF0000&quot;><font color=&quot;#FFFFFF&quot;><b><font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;>POST
NEW TOPIC<a name=&quot;post&quot;></a></font></b></font></td>
</tr>
<tr>
<form name=&quot;POST&quot; method=&quot;POST&quot; action=&quot;../forums/msgAdding.asp&quot;>
<td align=&quot;left&quot; valign=&quot;top&quot;>
<table border=&quot;0&quot; cellspacing=&quot;5&quot; cellpadding=&quot;5&quot;>
<tr align=&quot;left&quot; valign=&quot;middle&quot;>
<td align=&quot;right&quot; class=&quot;generalTextBold&quot;>Poster:</td>
<td class=&quot;generalTextBold&quot;><%= Request.Cookies(&quot;CookieUser&quot;) %>
<input type=&quot;hidden&quot; name=&quot;MSG_AUTHOR&quot; value=&quot;<%= Request.Cookies(&quot;CookieUser&quot;) %>&quot;>
</td>
</tr>
<tr align=&quot;left&quot; valign=&quot;middle&quot;>
<td align=&quot;right&quot; class=&quot;generalTextBold&quot;>Forum:</td>
<td class=&quot;generalTextBold&quot;>
<% If Request.QueryString(&quot;t&quot;) = &quot;&quot; Then %>
<select name=&quot;FOR_ID&quot; class = &quot;fields&quot; >
<%
While (NOT rsForumListing.EOF)
%>
<option value=&quot;<%=(rsForumListing.Fields.Item(&quot;FOR_ID&quot;).Value)%>&quot; <%if (CStr(rsForumListing.Fields.Item(&quot;FOR_ID&quot;).Value) = CStr(rsForumListing.Fields.Item(&quot;FOR_NAME&quot;).Value)) then Response.Write(&quot;SELECTED&quot;) : Response.Write(&quot;&quot;)%> ><%=(rsForumListing.Fields.Item(&quot;FOR_NAME&quot;).Value)%></option>
<%
rsForumListing.MoveNext()
Wend
If (rsForumListing.CursorType > 0) Then
rsForumListing.MoveFirst
Else
rsForumListing.Requery
End If
%>
</select>
<% Else %>
<%= Request.QueryString(&quot;t&quot;) %>
<input type=&quot;hidden&quot; name=&quot;FOR_ID&quot; value=&quot;<%= Request.QueryString(&quot;i&quot;) %>&quot;>
<input type=&quot;hidden&quot; name=&quot;FOR_NAME&quot; value=&quot;<%= Request.QueryString(&quot;t&quot;) %>&quot;>
<% End If %>
</td>
</tr>
<tr align=&quot;left&quot; valign=&quot;middle&quot;>
<td align=&quot;right&quot; class=&quot;generalTextBold&quot;> Subject:</td>
<td>
<input type=&quot;text&quot; name=&quot;MSG_SUBJECT&quot; size=&quot;50&quot; class = &quot;fields&quot; maxlength=&quot;50&quot;>
</td>
</tr>
<tr align=&quot;left&quot; valign=&quot;middle&quot;>
<td align=&quot;right&quot; class=&quot;generalTextBold&quot; valign=&quot;top&quot;>Message:</td>
<td>
<textarea name=&quot;MSG_BODY&quot; cols=&quot;60&quot; rows=&quot;10&quot; class = &quot;fields&quot;></textarea>
</td>
</tr>
<tr align=&quot;left&quot; valign=&quot;middle&quot;>
<td align=&quot;right&quot; class=&quot;generalTextBold&quot;>&nbsp; </td>
<td class=&quot;generalTextBold&quot;><span class=&quot;generalTextBold&quot;>Inform me
when someone replies?</span>
<input type=&quot;radio&quot; name=&quot;MSG_INFORMED&quot; value=&quot;YES&quot; checked >
<span class=&quot;generalTextBold&quot;>Yes</span>
<input type=&quot;radio&quot; name=&quot;MSG_INFORMED&quot; value=&quot;NO&quot; >
<span class=&quot;generalTextBold&quot;>No</span></td>
</tr>
<tr align=&quot;left&quot; valign=&quot;middle&quot;>
<td align=&quot;right&quot; class=&quot;generalTextBold&quot;>&nbsp;</td>
<td>
<input type=&quot;submit&quot; name=&quot;SUBMIT&quot; value=&quot;POST&quot; class = &quot;buttons&quot; onClick=&quot;smutEngine(this.form)&quot;>
</td>
</tr>
</table>
</td>
<% Else %>
<span class=&quot;generalTextred&quot;>To post a topic, please login or register.
Thank you.</span>
<% End If %>
</form>
</tr>
<tr>
<td align=&quot;left&quot; valign=&quot;top&quot; bgcolor=&quot;#000000&quot;><img src=&quot;../assets/spacer.gif&quot; width=&quot;1&quot; height=&quot;1&quot;></td>
</tr>
</table>
[gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
BTW, where did that test1 come from? I didn't type that in!!!!!!!!

Insert into Messages(FOR_ID,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED)VALUES(7,'test1','test 3/10 15:53','testing message on public forum','YES')
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/publicforum/forums/msgAdding.asp, line 62

&quot;test 3/10 15:53&quot; was subject and message was &quot;testing message on public forum&quot; [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
Never mind, I see now test1 is the login name.

Oh brother, I'm going batty!!!!!!!!!!! [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
ok, bear with me here.

Please verify that you did not type

test 3/10 15:53
[/color[

into the subject line. &quot;Never underestimate the power of determination&quot;

Stuart
 
try this again

ok, bear with me here.

Please verify that you did not type

test 3/10 15:53


into the subject line.
&quot;Never underestimate the power of determination&quot;

Stuart
 
Yes, that WAS the subject line. [gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
ok for subject line,

put just



subject test



it shouldnt matter, but its the only thing I can see so far.
Run that and see what happens. &quot;Never underestimate the power of determination&quot;

Stuart
 
OK, here goes. FYI this time I changed my logon name to Ladyborg2 so as to avoid confusion like before:

Insert into Messages(FOR_ID,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED)VALUES(7,'Ladyborg2','subject test','testing forum','YES')
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

/publicforum/forums/msgAdding.asp, line 62
[gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
on your earlier screenshot of

pfdb02.gif


can you do the same, but highlight MSG_TIME
so I can see those values. &quot;Never underestimate the power of determination&quot;

Stuart
 
OK here goes. BTW, disreguard the &quot;PUB_&quot; in front of the field names, that was just something I did when I was thinking of putting all forums on one db so as to cut down on the dns's for the site. That's another subject. Here's the screenshot:

pfdb03.gif
[gorgeous] Ladyborg
&quot;Many of life's failures are people who did not realize how close they were to success when they gave up.&quot; [Thomas A. Edison]
 
ok - I take it the PUB_ are removed then.

Going to go off of a hunch here, try this for the code.


<% Dim rs
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open MM_cnpublic_STRING


SQLstmt = &quot;Insert into Messages(FOR_ID,MSG_AUTHOR,MSG_SUBJECT,MSG_BODY,MSG_INFORMED)&quot;
SQLstmt = SQLstmt & &quot;VALUES(&quot; & cmdPost__for_id
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_author,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_subject, &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,'&quot; & Replace(cmdPost__msg_body, &quot;'&quot;, &quot;''&quot;) & &quot;'&quot;
SQLstmt = SQLstmt & &quot;,&quot; & cmdPost__msg_informed & &quot;&quot;
SQLstmt = SQLstmt & &quot;)&quot;
'response.Write SQLstmt
Set RS = Conn.Execute(SQLstmt)
set rs=nothing
Conn.Close
set conn=nothing
%>

&quot;Never underestimate the power of determination&quot;

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top