|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Code inserting some records twice
Hello, thank you for taking time to read this post...I hope someone can help.
I am working on an online survey, the problem is that my SQL query is inserting some entries twice. This survey is for members only so therefore require you to login ( so I can capture their membership number) The problem is the Membership Number is being inserted into the database(one record - membership number, no survey answers) as soon as the survey page is opened. When all of the survey questions are answered the Membership number and the responses are entered as a new record (one record - Membership number and survey answers) I am trying to use an if statement but the code is not to be working. Here is my code: <% dim sSQL,sConnString,mSQL, SubmitFlag pos=Request.form("pos") contract=Request.form("contract") ....... If SubmitFlag =1 Then sSQL="INSERT INTO wage (CompanyId,pos,contract,service,basic, bonus, total,car, pension, category) " & _ "VALUES ('" & MemNo & "','" & pos & "', '" & contract & "', '" & service & "', '" & basic & "', " & _ "'" & bonus & "','" & total & "','" & car & "','" & pension & "', 'Workshop')" objConn.execute(sSQL) 'close the object and free up resources objConn.Close Set objConn = Nothing End if %> //HTML Code <form name="form1" method="post" action=""> <input type="hidden" name="SumbitFlag" value="1"> Thank you for your help, hope I have explained it clearly enough!! |
|
#2
|
|||
|
|||
|
Im sorry I put this post in the wrong place should be in SQL Development.
|
|
#3
|
||||
|
||||
|
i think this should be in the programming section: i see no problem with your SQL statement, this is a programming problem, probaly the code running twice because of some circumstance
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Code inserting some records twice |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|