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]
 
P.S.: This happens when I try to add a message to the forum. The connection seems to be fine, I can see the forum when I log onto the default page, it's adding a message that's the problem. [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]
 
could be a missing or mis-typed field in DB.
try comparing both DBs

cmdPost__for_id - is it autonumber?
autonumbers should not be in the INSERT
 
The fields are ok, no typos anywhere on code or db.

for_id is not an autonumber. [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]
 
if you connect to your first DB is everything working?
 
ABSOLUTELY! That's what has me baffled. Not only that, but the 2nd one connects, that is, I can see the forum and any messages that I insert into the db manually. It's upon INSERTING into it via the forum that I get this nasty error.

Any ideas? Thanks for the help! [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]
 
confused,
so the 1st forum with 1st DB allows Inserts
and
2nd forum with 2nd DB or 1DB doesn't

???
 
Forum1 has db1 allowing inserts
Forum2 has db2 NOT allowing inserts

Instead I get a syntax error on my insert into statement that's driving me up the wall!
[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]
 
I haven't actually tried that BUT (to make things more infuriating) some of the test messages I was trying to post to forum2 ended up on forum1 instead!!!!! Totally different dsn's, so go figure! [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]
 
One step at a time, isolate things, narrow it all down.
Expanding your search for an answer by including the first database table is only confusing the issue.

Debug, debug, debug. And before you go and do it and run it - keep reading.

Where you have this


cmdPost.Prepared = true
cmdPost.Execute()


Replace with this

cmdPost.Prepared = true
response.write cmdPost
'cmdPost.Execute()




this will NOT insert anything into the database, it is a troubleshooting step.

it WILL write to the screen exactly how it is trying to insert it into the database - and thereby giving you clues.
unless of course you have a response.redirect somewhere - if so you need to place a ' infront of that too to stop the browser from shooting forward thinking all is well in the world.

Chances are you are trying to insert a wrong character. a text item into a numeric only field for example.

So, take a look at what it displays on the browser when you run it. Paste it back here if you cannot decipher it. &quot;Never underestimate the power of determination&quot;

Stuart
 
Done. Here's the error I received:
Response object error 'ASP 0185 : 8002000e'

Missing Default Property

/publicforum/forums/msgAdding.asp, line 0

A default property was not found for the object.

BTW, I REALLLLLLLY appreciate the help! You're an angel!
[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, remove the ' infront of 'cmdPost.Execute()


I'm still thinking it is an incorrect character.

Do this, open the database, switch to design view
list the fields and note if it is text, memo, numeric, etc.
and down below you will see a few options to select, such as required field - allow zero length.

It will look like this
image1.jpg

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

Stuart
 
I removed the ' and get the same error:

Response object error 'ASP 0185 : 8002000e'

Missing Default Property

/publicforum/forums/msgAdding.asp, line 0

A default property was not found for the object.

Regarding the db properties in design view: The table being inserted to is called MESSAGES here are fields and properties:
pfdb01.gif


Do you want all properties for all fields?


[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]
 
Here's full listing of FOR_ID properties. I have gotten errors referring to an error with it, but there was no syntax error:
pfdb02.gif


Is &quot;default value&quot; set to 0 correct? [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]
 
I noticed the error was at &quot;line 0&quot;, how can that be? [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 whole code

<% '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()
%>


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_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)
End IF
set rs=nothing
Conn.Close
set conn=nothing
%>

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

Stuart
 
Error:

Microsoft VBScript compilation error '800a0400'

Expected statement

/publicforum/forums/msgAdding.asp, line 79

End If 'submit = post ----> codes for posting a new message
^

Line 79 reads:
<% End If 'submit = post ----> codes for posting a new message %>


Lines just above & below it:
%>
<% Response.Redirect &quot;forum.asp?r=forums&t=&quot; & cmdPost__for_name & &quot;&i=&quot; & cmdPost__for_id %>
<% End If 'submit = post ----> codes for posting a new message %>
<% If Request.Form(&quot;SUBMIT&quot;) = &quot;REPLY&quot; then 'submit = post ----> codes for posting a new message %>
<%

[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]
 
ooops
replace 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)
End IF
set rs=nothing
Conn.Close
set conn=nothing
%>



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_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
%>
&quot;Never underestimate the power of determination&quot;

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

[Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.

/publicforum/forums/msgAdding.asp, line 62

Line 62 reads:
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top