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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate record when adding data

Status
Not open for further replies.
Feb 2, 2005
54
0
0
US
I have code that executes without errors in Firefox but gives me a duplicate record error in IE and it is driving me crazy. I can't seem to find where the problem is. The form data that is being posted is writing properly to the new database record but for some reason it appears that the ASP code executes again giving me a duplicate record error.

It's in IE v 7 and earlier as well.

Here's the code:

Code:
<%
	Dim objConn, objRs, strSQL
	Dim workorder, teamcell, contactperson, asset, servicerequested, extension, additionalcontactperson, additionalextension, completiondate, myMail
%>


<%
	workorder = Request.Form("workorder")
	teamcell = Request.Form("teamcell")
	contactperson = Trim(Request.Form("contactperson"))
	asset = Request.Form("asset")
	servicerequested = Request.Form("servicerequested")
	extension = Request.Form("extension")
	additionalcontactperson = Trim(Request.Form("additionalcontactperson"))
	additionalextension = Request.Form("additionalextension")
	completiondate = Request.Form("completiondate")
%>

<%	
	Set objConn = Server.CreateObject("ADODB.Connection")
	Set objRs = Server.CreateObject("ADODB.Recordset")
	objConn.Open "DSN=MAINT" 
	
	strSQL = "SELECT * FROM WORKORDERS"
	objRs.CursorType = 2
	objRs.LockType = 3
	objRs.Open strSQL, objConn
	objRs.AddNew
	objRs.Fields("Work_Order_Type") = "2"
	objRs.Fields("Work_Order") = workorder
	objRs.Fields("Status") = "1"
	objRs.Fields("Description") = "SERVICE REQUEST"
	objRs.Fields("Create_Date") = Now
	objRs.Fields("Requested_Start_Date") = Now
	objRs.Fields("Requested_End_Date") = completiondate
	objRs.Fields("User_Defined_1") = teamcell
	objRs.Fields("User_Defined_2") = contactperson
	objRs.Fields("User_Defined_3") = additionalcontactperson
	objRs.Fields("Instructions") = servicerequested
	objRs.Fields("Last_Status_Date") = Now
	objRs.Fields("Last_Edited_Date") = Now
	objRs.Fields("Created_By") = "SR"
	objRs.Fields("Last_Status_By") = "SR"
	objRs.Update
	objRs.Close
	
	Set objRs = Nothing
	Set objConn = Nothing

%>

Thanks!
 
This server-side code executes on the web server, not in a browser.

In fact, the code posted above contains no output, so it cannot be displayed in any browser.

Perhaps you intended to post some other code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top