Phillip Windell
2009-12-09 21:46:56 UTC
I am having problem with my ASP page creating a new databse record *twice*
when I subnet the page. This creates a duplicate records (except for the
autonumber ID field). They are ASP Classic pages written in VBS. The
database is an MS Access MDB file. Below you will find first a
"Response.write" output of an SQL Statement. Then below that is the code of
the page. The page is fairly short. I can include the relavant parts of
the two "include files" if you need them, but I doubt you will need them.
You should be able to tell from the SQL statement that the previous pages
are working corrrectly.
Thanks
--
Phillip Windell
The views expressed, are my own and not those of my employer, or Microsoft,
or anyone else associated with me, including my cats.
-----------------------------------------------------
--------------------------------SQL Statement---Ignore
line-wrap-------------------------------
INSERT INTO tblEvents (fldTitle, fldStartDate, fldEndDate, fldDetails,
fldApproved) VALUES ('This is a Title', #1/12/2012#, #1/13/2012#, 'This is a
Description', on)
----------------------------------------Page
code-----------------------------------------------
<% @LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> </TITLE>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18852"></HEAD>
<BODY>
<!-- #include FILE = "database.asp" -->
<!-- #include FILE = "functionsproceedures.asp" -->
<%
Dim intID
Dim strTitle
Dim strStartDate
Dim strEndDate
Dim strDetails
Dim strApproved
Dim strSQL
strTitle = CleanIllegalChar(Request.Form.Item("txtTitle"))
strStartDate = cDate(Request.Form.Item("txtStartDate"))
strEndDate = cDate(Request.Form.Item("txtEndDate"))
strDetails = CleanIllegalChar(Request.Form.Item("areaDetails"))
strApproved = Request.Form.Item("chkApproved")
If strApproved = "" then strApproved ="False"
'Response.write intID & "<br>"
'Response.write strTitle & "<br>"
'Response.write strStartDate & "<br>"
'Response.write strEndDate & "<br>"
'Response.write strDetails & "<br>"
'Response.write strApproved & "<br>"
'Create SQL string for Update
strSQL = "INSERT INTO tblEvents (fldTitle, fldStartDate, fldEndDate,
fldDetails, fldApproved) "
strSQL = strSQL & "VALUES ("
strSQL = strSQL & "'" & strTitle & "', "
strSQL = strSQL & "#" & strStartDate & "#, "
strSQL = strSQL & "#" & strEndDate & "#, "
strSQL = strSQL & "'" & strDetails & "', "
strSQL = strSQL & "" & strApproved & ""
strSQL = strSQL & ")"
'Write the changes
'Response.write strSQL
'Response.end
objConn.Execute strSQL
set objConn = Nothing
%>
<Input Type="Button" Name="btnDone"
Value="Done"onClick=window.location.href="manage.asp">
</BODY>
</HTML>
when I subnet the page. This creates a duplicate records (except for the
autonumber ID field). They are ASP Classic pages written in VBS. The
database is an MS Access MDB file. Below you will find first a
"Response.write" output of an SQL Statement. Then below that is the code of
the page. The page is fairly short. I can include the relavant parts of
the two "include files" if you need them, but I doubt you will need them.
You should be able to tell from the SQL statement that the previous pages
are working corrrectly.
Thanks
--
Phillip Windell
The views expressed, are my own and not those of my employer, or Microsoft,
or anyone else associated with me, including my cats.
-----------------------------------------------------
--------------------------------SQL Statement---Ignore
line-wrap-------------------------------
INSERT INTO tblEvents (fldTitle, fldStartDate, fldEndDate, fldDetails,
fldApproved) VALUES ('This is a Title', #1/12/2012#, #1/13/2012#, 'This is a
Description', on)
----------------------------------------Page
code-----------------------------------------------
<% @LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> </TITLE>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18852"></HEAD>
<BODY>
<!-- #include FILE = "database.asp" -->
<!-- #include FILE = "functionsproceedures.asp" -->
<%
Dim intID
Dim strTitle
Dim strStartDate
Dim strEndDate
Dim strDetails
Dim strApproved
Dim strSQL
strTitle = CleanIllegalChar(Request.Form.Item("txtTitle"))
strStartDate = cDate(Request.Form.Item("txtStartDate"))
strEndDate = cDate(Request.Form.Item("txtEndDate"))
strDetails = CleanIllegalChar(Request.Form.Item("areaDetails"))
strApproved = Request.Form.Item("chkApproved")
If strApproved = "" then strApproved ="False"
'Response.write intID & "<br>"
'Response.write strTitle & "<br>"
'Response.write strStartDate & "<br>"
'Response.write strEndDate & "<br>"
'Response.write strDetails & "<br>"
'Response.write strApproved & "<br>"
'Create SQL string for Update
strSQL = "INSERT INTO tblEvents (fldTitle, fldStartDate, fldEndDate,
fldDetails, fldApproved) "
strSQL = strSQL & "VALUES ("
strSQL = strSQL & "'" & strTitle & "', "
strSQL = strSQL & "#" & strStartDate & "#, "
strSQL = strSQL & "#" & strEndDate & "#, "
strSQL = strSQL & "'" & strDetails & "', "
strSQL = strSQL & "" & strApproved & ""
strSQL = strSQL & ")"
'Write the changes
'Response.write strSQL
'Response.end
objConn.Execute strSQL
set objConn = Nothing
%>
<Input Type="Button" Name="btnDone"
Value="Done"onClick=window.location.href="manage.asp">
</BODY>
</HTML>