Hi. I've got a simple submit form page which works perfectly, except that it inserts the same record twice (but with different auto ids). It only does this the first time I add a record for a particular company, once the duplicate record is in there I can just add records for that company normally. Why would that be? My code is as follows
[red]<%
option explicit
dim objCn, objRs, sSql
%>
<!--#include file = "../includes/db.asp"-->
<%
dim complaint_id, company_qr, complaint_date, complaint, action
dim training_raised, procedural_raised, date_completed, follow_call
company_qr = session("COMPANY"
complaint_date = request.form("txtComplaintDate"
complaint = request.form("txtComplaint"
action = request.form("txtAction"
training_raised = request.form("txtTrainingIssue"
procedural_raised = request.form("txtProceduralIssue"
date_completed = request.form("txtDateCompleted"
follow_call = request.form("txtFollowUpCall"
call openConnection(objCn)
sSql = "INSERT INTO COMPANY_COMPLAINTS (COMPANY_QR, COMPLAINT_DATE, COMPLAINT, " &_
"ACTION, TRAINING_ISSUE_RAISED, PROCEDURAL_ISSUE_RAISED, DATE_COMPLETED, " &_
"FOLLOW_UP_CALL) VALUES('" & company_qr & "', '" & complaint_date & "', '" &_
complaint & "', '" & action & "', '" & training_raised & "', '" & procedural_raised & "', '" &_
date_completed & "', '" & follow_call & "')"
set objRs = objCn.execute (sSql)
call closeConnection(objCn)
response.redirect "viewcomplaints.asp"
%>[/red]
Or would I be best to post this in the SQL forum? Thanks for help
Cheers
Sarah ;-)
[red]<%
option explicit
dim objCn, objRs, sSql
%>
<!--#include file = "../includes/db.asp"-->
<%
dim complaint_id, company_qr, complaint_date, complaint, action
dim training_raised, procedural_raised, date_completed, follow_call
company_qr = session("COMPANY"
complaint_date = request.form("txtComplaintDate"
complaint = request.form("txtComplaint"
action = request.form("txtAction"
training_raised = request.form("txtTrainingIssue"
procedural_raised = request.form("txtProceduralIssue"
date_completed = request.form("txtDateCompleted"
follow_call = request.form("txtFollowUpCall"
call openConnection(objCn)
sSql = "INSERT INTO COMPANY_COMPLAINTS (COMPANY_QR, COMPLAINT_DATE, COMPLAINT, " &_
"ACTION, TRAINING_ISSUE_RAISED, PROCEDURAL_ISSUE_RAISED, DATE_COMPLETED, " &_
"FOLLOW_UP_CALL) VALUES('" & company_qr & "', '" & complaint_date & "', '" &_
complaint & "', '" & action & "', '" & training_raised & "', '" & procedural_raised & "', '" &_
date_completed & "', '" & follow_call & "')"
set objRs = objCn.execute (sSql)
call closeConnection(objCn)
response.redirect "viewcomplaints.asp"
%>[/red]
Or would I be best to post this in the SQL forum? Thanks for help
Cheers
Sarah ;-)
[sub]WASN'T FIT ENOUGH FOR THE POLICE FORCE[/sub]