Forums

ASP

This topic is locked

Problem with Command

Posted 04 Dec 2003 22:38:59
1
has voted
04 Dec 2003 22:38:59 Robert Barker posted:
I have a page that uses an HTML editor to pass along variables to another page that has an insert command on it. Everything passes fine, and everything functions properly, but the insert and /or the table in the Access database inserts two new records instead of one. The page of insertion is as following. Help please.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/admin.asp" -->
<%

if(Request.Form("newsletterMODIFYBY" <> "" then CMDINSERT__inpPage = Request.Form("newsletterMODIFYBY"

if(Request.Form("inpTitle" <> "" then CMDINSERT__inpTitle = Request.Form("inpTitle"

if(Request.Form("inpContent" <> "" then CMDINSERT__inpContent = Request.Form("inpContent"

%>
<%

set CMDINSERT = Server.CreateObject("ADODB.Command"
CMDINSERT.ActiveConnection = MM_admin_STRING
CMDINSERT.CommandText = "INSERT INTO NEWSLETTER (newsletterMODIFYBY, newsletterTITLE, newsletterBODY) VALUES ('" + Replace(CMDINSERT__inpPage, "'", "''" + "', '" + Replace(CMDINSERT__inpTitle, "'", "''" + "', '" + Replace(CMDINSERT__inpContent, "'", "''" + "') "
CMDINSERT.CommandType = 1
CMDINSERT.CommandTimeout = 0
CMDINSERT.Prepared = true
CMDINSERT.Execute()

%>

Reply to this topic